UpdateDatabaseWindow.xaml.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Windows;
  2. namespace AIPractice.LabellerServer.WPF
  3. {
  4. /// <summary>
  5. /// Interaction logic for UpdateDatabaseWindow.xaml
  6. /// </summary>
  7. public partial class UpdateDatabaseWindow : Window
  8. {
  9. public double Progress
  10. {
  11. get => ProgressBar.Value;
  12. set => ProgressBar.Value = value;
  13. }
  14. public UpdateDatabaseWindow(bool showProgress = true)
  15. {
  16. InitializeComponent();
  17. if (!showProgress)
  18. {
  19. UpdateInfo.Visibility = Visibility.Collapsed;
  20. ProgressBar.Visibility = Visibility.Collapsed;
  21. WaitingBox.Visibility = Visibility.Visible;
  22. Waiting.StartWaitingSpinner();
  23. }
  24. else
  25. {
  26. UpdateInfo.Visibility = Visibility.Visible;
  27. ProgressBar.Visibility = Visibility.Visible;
  28. WaitingBox.Visibility = Visibility.Collapsed;
  29. }
  30. }
  31. public void SetUpdatedCount(int count, int total)
  32. {
  33. UpdateInfo.Text = $"更新中...{(int) Progress}%, 已更新数目:{count}, 总计:{total}";
  34. }
  35. }
  36. }