本文整理汇总了C#中Settings.SaveToFile方法的典型用法代码示例。如果您正苦于以下问题:C# Settings.SaveToFile方法的具体用法?C# Settings.SaveToFile怎么用?C# Settings.SaveToFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings.SaveToFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//.........这里部分代码省略.........
Settings.Initialise();
}
catch( Exception ex )
{
Log.AddEntry( ex );
MessageBox.Show( ex.Message,
"Settings Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error );
}
// P4.
string envVarPath = ( Environment.GetEnvironmentVariable( "path" ) ?? "" ).ToLower();
string[] envVarPathEntries = envVarPath.Split( ';' );
string p4Path = null;
foreach( string entry in envVarPathEntries )
{
if( File.Exists( entry + @"\p4.exe" ) )
{
p4Path = entry;
break;
}
}
if( p4Path == null )
{
MessageBox.Show(
"Could not find p4.exe in any path in the PATH environment-variable, please add " +
"the path where p4.exe is located to the PATH environment-variable.",
"Perforce Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error );
return;
}
Log.AddEntry(
Log.EntryType.INFO,
"P4 path: " + p4Path );
// Db.
try
{
// Try connect to the databases.
try
{
DbConnection = DbConnection.Instance;
}
catch( Exception ex )
{
Log.AddEntry( ex );
MessageBox.Show(
ex.Message,
"Database Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error );
return;
}
// Connected to the DB?
if( DbConnection.Critr.State != System.Data.ConnectionState.Open )
{
Log.AddEntry(
Log.EntryType.ERROR,
"Failed to connect to the database." );
MessageBox.Show(
"Failed to connect to the database.",
"Database Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error );
}
}
catch( Exception ex )
{
Log.AddEntry( ex );
MessageBox.Show(
ex.Message,
"Database Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error );
}
// Init some things.
UserCollection = new UserCollection();
ChangelistHelpers.LoadChangelistsFromDb();
// Start the app.
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault( false );
Application.Run( new MainForm() );
// Shutdown.
Settings.SaveToFile();
Log.AddInfo( "Shutdown." );
}