终端一体化运控平台
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

86 行
2.6 KiB

  1. using BPA.Helper;
  2. using BPASmartClient.Update.Model;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading;
  9. using System.Threading.Tasks;
  10. using System.Windows;
  11. using System.Windows.Controls;
  12. using System.Windows.Data;
  13. using System.Windows.Documents;
  14. using System.Windows.Input;
  15. using System.Windows.Media;
  16. using System.Windows.Media.Imaging;
  17. using System.Windows.Navigation;
  18. using System.Windows.Shapes;
  19. namespace BPASmartClient.Update
  20. {
  21. /// <summary>
  22. /// Interaction logic for MainWindow.xaml
  23. /// </summary>
  24. public partial class MainWindow : Window
  25. {
  26. public MainWindow()
  27. {
  28. InitializeComponent();
  29. this.grProgressbar.Visibility = Visibility.Collapsed;
  30. }
  31. private void cancel_Click(object sender, RoutedEventArgs e)
  32. {
  33. this.Close();
  34. }
  35. private async void ok_Click(object sender, RoutedEventArgs e)
  36. {
  37. this.cancel.Visibility = Visibility.Collapsed;
  38. this.grProgressbar.Visibility = Visibility.Visible;
  39. await Task.Run(() =>
  40. {
  41. App.Current.Dispatcher.Invoke(() =>
  42. {
  43. this.progressbar.Value = 25;
  44. this.tb.Text = "当前更新进度:1/4";
  45. });
  46. Thread.Sleep(2000);
  47. App.Current.Dispatcher.Invoke(() =>
  48. {
  49. this.progressbar.Value = 50;
  50. this.tb.Text = "当前更新进度:2/4";
  51. });
  52. Thread.Sleep(1500);
  53. App.Current.Dispatcher.Invoke(() =>
  54. {
  55. this.progressbar.Value = 75;
  56. this.tb.Text = "当前更新进度:3/4";
  57. });
  58. Thread.Sleep(3000);
  59. App.Current.Dispatcher.Invoke(() =>
  60. {
  61. this.progressbar.Value = 100;
  62. this.tb.Text = "当前更新进度:4/4";
  63. });
  64. Thread.Sleep(1500);
  65. App.Current.Dispatcher.Invoke(() =>
  66. {
  67. this.progressbar.Value = 100;
  68. this.tb.Text = "当前更新进度:更新完成";
  69. });
  70. Thread.Sleep(1500);
  71. });
  72. string directory = AppDomain.CurrentDomain.BaseDirectory;
  73. Process.Start($"{directory}BPASmartClient.DosingSystem.exe");
  74. Json<UpdateModel>.Save();
  75. this.Close();
  76. }
  77. }
  78. }