|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- using BPA.Helper;
- using BPASmartClient.Update.Model;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
-
- namespace BPASmartClient.Update
- {
- /// <summary>
- /// Interaction logic for MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
- this.grProgressbar.Visibility = Visibility.Collapsed;
- }
-
- private void cancel_Click(object sender, RoutedEventArgs e)
- {
- this.Close();
- }
-
- private async void ok_Click(object sender, RoutedEventArgs e)
- {
- this.cancel.Visibility = Visibility.Collapsed;
- this.grProgressbar.Visibility = Visibility.Visible;
- await Task.Run(() =>
- {
- App.Current.Dispatcher.Invoke(() =>
- {
- this.progressbar.Value = 25;
- this.tb.Text = "当前更新进度:1/4";
- });
- Thread.Sleep(2000);
-
- App.Current.Dispatcher.Invoke(() =>
- {
- this.progressbar.Value = 50;
- this.tb.Text = "当前更新进度:2/4";
- });
- Thread.Sleep(1500);
-
- App.Current.Dispatcher.Invoke(() =>
- {
- this.progressbar.Value = 75;
- this.tb.Text = "当前更新进度:3/4";
- });
- Thread.Sleep(3000);
-
- App.Current.Dispatcher.Invoke(() =>
- {
- this.progressbar.Value = 100;
- this.tb.Text = "当前更新进度:4/4";
- });
- Thread.Sleep(1500);
-
- App.Current.Dispatcher.Invoke(() =>
- {
- this.progressbar.Value = 100;
- this.tb.Text = "当前更新进度:更新完成";
- });
- Thread.Sleep(1500);
- });
- string directory = AppDomain.CurrentDomain.BaseDirectory;
- Process.Start($"{directory}BPASmartClient.DosingSystem.exe");
- Json<UpdateModel>.Save();
- this.Close();
- }
- }
- }
|