private void btnUpdate_Click(object sender, RoutedEventArgs e) { UpdateViewModel.KillMainProcess(); this.Close(); UpdateViewModel vm = new UpdateViewModel(_updateVersion, _curVersion); UpdateWindow win = new UpdateWindow(); win.DataContext = vm; win.ShowDialog(); Application.Current?.Shutdown(0); if (vm.IsStartMainApp) { System.Diagnostics.Process.Start(MainProgramPath); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.root = ((IMLaunch.UpdateWindow)(target)); return; case 2: #line 24 "..\..\UpdateWindow.xaml" ((System.Windows.Controls.Grid)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.Grid_MouseLeftButtonDown); #line default #line hidden return; case 3: this.btnMin = ((System.Windows.Controls.Button)(target)); #line 27 "..\..\UpdateWindow.xaml" this.btnMin.Click += new System.Windows.RoutedEventHandler(this.btnMin_Click); #line default #line hidden return; case 4: this.tbVersion = ((System.Windows.Controls.TextBlock)(target)); return; case 5: this.progressPnl = ((System.Windows.Controls.StackPanel)(target)); return; } this._contentLoaded = true; }
private void btnUpdate_Click(object sender, RoutedEventArgs e) { this.Hide(); UpdateViewModel vm = new UpdateViewModel(UpdateVersion, CurVersion); UpdateWindow win = new UpdateWindow(); win.DataContext = vm; win.ShowDialog(); if (!vm.IsError) { Application.Current?.Shutdown(0); } else { UpdateFailedWindow.Instance().ShowDialog(); } if (vm.IsStartMainApp) { System.Diagnostics.Process.Start(string.Format(@"{0}\{1}", AppDomain.CurrentDomain.BaseDirectory, App.MainProgramName)); } }