static void Main() { AppNoStartupUri app = new AppNoStartupUri { ShutdownMode = ShutdownMode.OnExplicitShutdown }; app.Startup += App_Startup; // app.InitializeComponent(); SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext()); var p = new Program(); p.ExitRequested += (sender, e) => { app.Shutdown(); }; Task programStart = p.StartAsync(); HandleExceptions(programStart, app); try { app.Run(); } catch (Exception e) { Debug.WriteLine(e); } }
public void Start() { var viewModel = new MainViewModel(); viewModel.CloseRequested += viewModel_CloseRequested; viewModel.Initialize(); var mainForm = new MainWindow(); mainForm.Closed += (sender, e) => { viewModel.RequestClose(); }; mainForm.DataContext = viewModel; mainForm.Show(); m_app.Run(); }
static void Main() { AppNoStartupUri app = new AppNoStartupUri { ShutdownMode = ShutdownMode.OnExplicitShutdown }; app.InitializeComponent(); Program4 p = new Program4(); p.ExitRequested += (sender, e) => { app.Shutdown(); }; Task programStart = p.StartAsync(); app.Run(); }
static void Main() { AppNoStartupUri app = new AppNoStartupUri { ShutdownMode = ShutdownMode.OnExplicitShutdown }; app.InitializeComponent(); SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext()); Program5 p = new Program5(); p.ExitRequested += (sender, e) => { app.Shutdown(); }; Task programStart = p.StartAsync(); HandleExceptions(programStart, app); app.Run(); }
static void Main() { var app = new AppNoStartupUri { ShutdownMode = ShutdownMode.OnExplicitShutdown }; app.InitializeComponent(); SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext()); var p = new Program(); p.ExitRequested += (sender, e) => { app.Shutdown(); }; var t = p.StartAsync(); Handle(t); app.Run(); }
//static async Task Main(string[] args) static void Main() { _logger = new Common.LoggerTest(); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; var app = new AppNoStartupUri { ShutdownMode = ShutdownMode.OnExplicitShutdown }; app.InitializeComponent(); SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext()); var p = new Program(); p.ExitRequested += (sender, e) => { app.Shutdown(); }; var t = p.StartAsync(); Handle(t); app.Run(); }