diff --git a/PetWash.Api/petwash.db b/PetWash.Api/petwash.db index 251e262..ff520a0 100644 Binary files a/PetWash.Api/petwash.db and b/PetWash.Api/petwash.db differ diff --git a/PetWash.Api/petwash.db-shm b/PetWash.Api/petwash.db-shm index b8dbf7c..9d3c4ee 100644 Binary files a/PetWash.Api/petwash.db-shm and b/PetWash.Api/petwash.db-shm differ diff --git a/PetWash.Api/petwash.db-wal b/PetWash.Api/petwash.db-wal index 3e616b6..bb67849 100644 Binary files a/PetWash.Api/petwash.db-wal and b/PetWash.Api/petwash.db-wal differ diff --git a/PetWashControl/ViewModels/MainViewModel.cs b/PetWashControl/ViewModels/MainViewModel.cs index 4275647..c9d3828 100644 --- a/PetWashControl/ViewModels/MainViewModel.cs +++ b/PetWashControl/ViewModels/MainViewModel.cs @@ -988,8 +988,9 @@ public partial class MainViewModel : ObservableObject IsDoorOpen = true; StatusMessage = "清洗完成!请取出宠物"; - MessageBox.Show("清洗完成!\n\n感谢使用无人自动洗宠机", "完成", - MessageBoxButton.OK, MessageBoxImage.Information); + // 显示自动关闭的完成对话框 + var dialog = new Views.CompletionDialog(); + dialog.ShowDialog(); _logger.LogInfo("订单流程完成"); diff --git a/PetWashControl/Views/CompletionDialog.xaml b/PetWashControl/Views/CompletionDialog.xaml new file mode 100644 index 0000000..9ee85e4 --- /dev/null +++ b/PetWashControl/Views/CompletionDialog.xaml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PetWashControl/Views/CompletionDialog.xaml.cs b/PetWashControl/Views/CompletionDialog.xaml.cs new file mode 100644 index 0000000..ac0ab49 --- /dev/null +++ b/PetWashControl/Views/CompletionDialog.xaml.cs @@ -0,0 +1,57 @@ +using System; +using System.Windows; +using System.Windows.Threading; + +namespace PetWashControl.Views +{ + public partial class CompletionDialog : Window + { + private DispatcherTimer? _countdownTimer; + private int _remainingSeconds = 30; + + public CompletionDialog() + { + InitializeComponent(); + StartCountdown(); + } + + private void StartCountdown() + { + _countdownTimer = new DispatcherTimer + { + Interval = TimeSpan.FromSeconds(1) + }; + _countdownTimer.Tick += CountdownTimer_Tick; + _countdownTimer.Start(); + } + + private void CountdownTimer_Tick(object? sender, EventArgs e) + { + _remainingSeconds--; + + if (_remainingSeconds > 0) + { + CountdownText.Text = $"{_remainingSeconds}秒后自动返回首页"; + } + else + { + _countdownTimer?.Stop(); + DialogResult = true; + Close(); + } + } + + private void OkButton_Click(object sender, RoutedEventArgs e) + { + _countdownTimer?.Stop(); + DialogResult = true; + Close(); + } + + protected override void OnClosed(EventArgs e) + { + _countdownTimer?.Stop(); + base.OnClosed(e); + } + } +}