本文整理汇总了C#中App.InitializeComponent方法的典型用法代码示例。如果您正苦于以下问题:C# App.InitializeComponent方法的具体用法?C# App.InitializeComponent怎么用?C# App.InitializeComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App
的用法示例。
在下文中一共展示了App.InitializeComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
if (SingleInstance<App>.InitializeAsFirstInstance(Unique))
{
try
{
var startMinimized = false;
if (args != null)
{
var minimized = args.FirstOrDefault();
if (minimized != null && minimized.Equals(Constants.Minimized))
{
startMinimized = true;
}
}
var application = new App(startMinimized);
application.InitializeComponent();
application.Run();
}
finally
{
// Allow single instance code to perform cleanup operations
SingleInstance<App>.Cleanup();
}
}
}
示例2: Initialize
public static void Initialize()
{
var app = new App();
app.InitializeComponent();
app.Run();
}
示例3: Main
public static void Main()
{
if (SingleInstance<App>.InitializeAsFirstInstance(AppName))
{
XmlConfigurator.Configure();
s_log = LogManager.GetLogger(typeof(App));
AppDomain.CurrentDomain.UnhandledException += Application_DispatcherUnhandledException;
if (ApplicationDeployment.IsNetworkDeployed)
{
AppVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(4);
s_log.Info("Configure crash reports");
}
s_log.Info("Displaying splash screen");
SplashScreen splashScreen = new SplashScreen("Images/logo.png");
splashScreen.Show(true);
s_log.Info("Starting Jenkins Build Monitor...");
App application = new App();
application.InitializeComponent();
application.Run();
// Allow single instance code to perform cleanup operations
s_log.Info("Cleaning up single instance app...");
SingleInstance<App>.Cleanup();
}
}
示例4: Main
public static void Main(string[] args)
{
if (SingleInstance<App>.InitializeAsFirstInstance(Unique))
{
string filename;
if (args != null && args.Length == 1)
{
if (System.IO.File.Exists(System.IO.Path.GetFullPath(args[0])))
{
filename = System.IO.Path.GetFileName(System.IO.Path.GetFullPath(args[0]));
if (filename.EndsWith("osapp", StringComparison.Ordinal))
{
// its a plugin package
PluginInstallerHelper pInst = new PluginInstallerHelper();
pInst.InstallPlugin(System.IO.Path.GetFullPath(args[0]));
}
}
}
else
{
var application = new App();
application.InitializeComponent();
application.Run();
}
// Allow single instance code to perform cleanup operations
SingleInstance<App>.Cleanup();
}
}
示例5: Main
public static void Main( string[] args )
{
try
{
// Crash logs upload and updater availability is managed during this initialization.
using( var init = CKApp.Initialize( new CKAppParameters( "CK-Windows", "Demo" ) ) )
{
if( init != null )
{
// Common logger is actually bound to log4net.
// CK-Windows must not depend on log4Net: its initialization must be done here.
CommonLogger.Initialize( CKApp.CurrentParameters.ApplicationDataPath + @"AppLogs\", false );
CKApp.Run( () =>
{
App app = new App();
app.InitializeComponent();
return app;
} );
}
}
}
catch( Exception ex )
{
Console.WriteLine( ex.Message );
}
}
示例6: Main
public static void Main(string[] args)
{
var serialNumber = RWReg.GetValue(Constants.SubName, "Cache", string.Empty).ToString();
if (!string.IsNullOrEmpty(serialNumber)
&& Common.IsAdmin())
{
try
{
RWReg.RemoveKey(Constants.SubName, "Cache");
// 软件注册
RWReg.SetValue(
Microsoft.Win32.Registry.LocalMachine,
Constants.SubName,
"Cache", serialNumber);
}
catch
{
}
finally
{
System.Environment.Exit(System.Environment.ExitCode);
}
}
else
{
var app = new App();
app.InitializeComponent();
app.Run();
}
}
示例7: Main
public static void Main()
{
App app = new App();
app.InitializeComponent();
app.Run();
AValue.ConfigData.Save();
}
示例8: LoadServices
public static void LoadServices(this IEnumerable<ServiceBase> services)
{
// if run from visual studio:
//if (!Debugger.IsAttached) return;
var t = Task.Factory.StartNew
(
() =>
{
var app = new App();
app.InitializeComponent();
app.Startup += (o, e) =>
{
var window = new Window
{
Width = 350,
Height = 200,
Title = "Windows Service Runner",
Content =
new ServicesControllerViewModel(
services.Select(s => new ServiceViewModel(s)).ToList())
};
window.Show();
};
app.Run();
},
CancellationToken.None,
TaskCreationOptions.PreferFairness,
new StaTaskScheduler(25)
);
t.Wait();
}
示例9: Main
public static void Main(string[] args)
{
Thread.CurrentThread.Name = "CMain";
MyTraceContext.ThreadTraceContext = new MyTraceContext("Client");
Trace.TraceInformation("Start");
if (args.Contains("adventure"))
ClientConfig.NewGameMode = GameMode.Adventure;
else if (args.Contains("fortress"))
ClientConfig.NewGameMode = GameMode.Fortress;
StartupStopwatch = Stopwatch.StartNew();
if (Debugger.IsAttached == false)
{
var splashScreen = new System.Windows.SplashScreen("Images/splash.png");
splashScreen.Show(true, true);
}
var app = new App();
app.InitializeComponent();
app.Run();
Trace.TraceInformation("Stop");
}
示例10: Main
public static void Main()
{
if (SingleInstance<App>.InitializeAsFirstInstance(Unique))
{
#if !DEBUG
Update().Wait();
#endif
Logger.Info("Starting up.");
// Initialize process helper
ProcessHelper.Instance.Initialize();
var application = new App();
application.InitializeComponent();
application.ShutdownMode = ShutdownMode.OnMainWindowClose;
// register unhandled exceptions
AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
Current.DispatcherUnhandledException += CurrentOnDispatcherUnhandledException;
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
application.Run();
Logger.Info("Closing.");
// Allow single instance code to perform cleanup operations
SingleInstance<App>.Cleanup();
Environment.Exit(0);//application doesn't fully exit without this for some reason
}
}
示例11: Main
public static void Main()
{
mutex = new Mutex(true, Process.GetCurrentProcess().ProcessName, out created);
if (!created)
{
return;
}
// As all first run initialization is done in the main project,
// we need to make sure the user does not start a different knot first.
if (CfgFile.Get("FirstRun") != "0")
{
try
{
ProcessStartInfo process = new ProcessStartInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\FreemiumUtilities.exe");
Process.Start(process);
}
catch (Exception)
{
}
}
else
{
App app = new App();
Permissions.SetPrivileges(true);
app.InitializeComponent();
app.Run();
Permissions.SetPrivileges(false);
}
}
示例12: Main
public static void Main()
{
splashScreen = new SplashScreen("mediascribe-splashscreen2.png");
splashScreen.Show(true, false);
#if (DEBUG==false)
try
{
#endif
if (SingleInstance<App>.InitializeAsFirstInstance(Unique))
{
var application = new App();
application.InitializeComponent();
application.Run();
// Allow single instance code to perform cleanup operations
SingleInstance<App>.Cleanup();
}
#if (DEBUG==false)
}
catch (Exception e)
{
Logging.Log(LoggingSource.Errors, e.ToString() + "\r\n\r\n");
MessageBox.Show("An error has occured -- please go to http://mediascribe.jarrod.co.nz/contact/ and get in touch.");
}
#endif
}
示例13: Main
public static int Main()
{
int functionReturnResult = -1;
using (var app = new App())
{
Action applicationAction =
() =>
{
app.InitializeComponent();
app.Run();
functionReturnResult = NormalApplicationExitCode;
};
using (var processor = new LogBasedExceptionProcessor(
LoggerBuilder.ForFile(
Path.Combine(FileConstants.LogPath(), DefaultErrorFileName),
new DebugLogTemplate(new NullConfiguration(), () => DateTimeOffset.Now))))
{
var result = TopLevelExceptionGuard.RunGuarded(
applicationAction,
new ExceptionProcessor[]
{
processor.Process,
});
return (result == GuardResult.Failure) ? UnhandledExceptionApplicationExitCode : functionReturnResult;
}
}
}
示例14: Main
public static void Main()
{
// Set the image file's build action to "Resource" and "Never copy" for this to work.
if (!Debugger.IsAttached)
{
App.SplashScreen = new SplashScreen("Images/TxFlag_256.png");
App.SplashScreen.Show(false, true);
}
// Set up FieldLog
FL.AcceptLogFileBasePath();
FL.RegisterPresentationTracing();
TaskHelper.UnhandledTaskException = ex => FL.Critical(ex, "TaskHelper.UnhandledTaskException", true);
// Keep the setup away
GlobalMutex.Create("Unclassified.TxEditor");
App.InitializeSettings();
// Make sure the settings are properly saved in the end
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
// Setup logging
//Tx.LogFileName = "tx.log";
//Tx.LogFileName = "";
//Environment.SetEnvironmentVariable("TX_LOG_UNUSED", "1", EnvironmentVariableTarget.User);
//Environment.SetEnvironmentVariable("TX_LOG_UNUSED", null, EnvironmentVariableTarget.User);
InitializeLocalisation();
App app = new App();
app.InitializeComponent();
app.Run();
}
示例15: Run
// Run WPF application.
private static void Run()
{
App app = new App();
app.Exit += new ExitEventHandler(RestartExitHandler);
app.InitializeComponent();
app.Run();
}