本文整理汇总了C#中App.Run方法的典型用法代码示例。如果您正苦于以下问题:C# App.Run方法的具体用法?C# App.Run怎么用?C# App.Run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App
的用法示例。
在下文中一共展示了App.Run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
App app = new App();
#if !DEBUG
Console.WriteLine("NOT in DEBUG mode");
try
{
app.Run(new MainWindow());
}
catch (Exception e)
{
ErrorWindow ew = new ErrorWindow();
if (e.StackTrace != null)
ew.Message = "In " + e.TargetSite + ": " + e.Message +
";\r\n" + e.StackTrace;
else
ew.Message = "In EEGArtifactEditor: " + e.Message;
ew.ShowDialog();
}
#else
Console.WriteLine("In DEBUG mode");
app.Run(new MainWindow());
#endif
}
示例2: Main
public static void Main(string[] args)
{
App app = new App();
if(args.Count()>=1)
{
app.Run(new Window1(args[0]));
}
else
{
app.Run(new Window1(""));
}
}
示例3: OnStartup
protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
{
app = new App();
//app.InitializeComponent();
app.Run();
return false;
}
示例4: Main
static void Main()
{
using (App game = new App())
{
game.Run();
}
}
示例5: Main
public static void Main()
{
// before actually starting up, check if there is already an instance running
if (SingleInstance<App>.InitializeAsFirstInstance(UniqueAppName))
{
var application = new App();
application.InitializeComponent();
application.Run();
// Allow single instance code to perform cleanup operations
SingleInstance<App>.Cleanup();
// then do the rest
if (null == Current)
{
new Application();
}
Current.DispatcherUnhandledException += App_DispatcherUnhandledException;
Current.SessionEnding += App_SessionEnding;
}
//else
//{
// var msg = "An instance of PersonalAnalytics was already running. Access it from the task bar on the bottom right of your screen.";
// MessageBox.Show("Info", msg);
//}
}
示例6: Main
static void Main()
{
App app = new App();
Current.Resources.MergedDictionaries.Add(LoadComponent(
new Uri("Controls;component/Themes/Styles.xaml", UriKind.Relative)) as ResourceDictionary);
app.Run();
}
示例7: 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();
}
示例8: Main
static void Main()
{
ServiceFactory.StartupService.Run();
var app = new App();
ServiceFactory.ResourceService.AddResource(typeof(UIBehavior).Assembly, "Themes/Styles.xaml");
app.Run();
}
示例9: 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
}
}
示例10: 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;
}
}
}
示例11: Run
// Run WPF application.
private static void Run()
{
App app = new App();
app.Exit += new ExitEventHandler(RestartExitHandler);
app.InitializeComponent();
app.Run();
}
示例12: 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();
}
}
示例13: Initialize
public static void Initialize()
{
var app = new App();
app.InitializeComponent();
app.Run();
}
示例14: Main
private static void Main()
{
var app = new App();
var window = new MainWindow();
window.Show();
app.Run(window);
}
示例15: OnStartup
protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
{
// First time app is launched
app = new App();
app.Run();
return false;
}