feat: 优化流程
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -988,8 +988,9 @@ public partial class MainViewModel : ObservableObject
|
|||||||
IsDoorOpen = true;
|
IsDoorOpen = true;
|
||||||
StatusMessage = "清洗完成!请取出宠物";
|
StatusMessage = "清洗完成!请取出宠物";
|
||||||
|
|
||||||
MessageBox.Show("清洗完成!\n\n感谢使用无人自动洗宠机", "完成",
|
// 显示自动关闭的完成对话框
|
||||||
MessageBoxButton.OK, MessageBoxImage.Information);
|
var dialog = new Views.CompletionDialog();
|
||||||
|
dialog.ShowDialog();
|
||||||
|
|
||||||
_logger.LogInfo("订单流程完成");
|
_logger.LogInfo("订单流程完成");
|
||||||
|
|
||||||
|
|||||||
93
PetWashControl/Views/CompletionDialog.xaml
Normal file
93
PetWashControl/Views/CompletionDialog.xaml
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
<Window x:Class="PetWashControl.Views.CompletionDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
Title="完成"
|
||||||
|
Height="250"
|
||||||
|
Width="400"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
WindowStyle="None"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
Background="Transparent"
|
||||||
|
ResizeMode="NoResize">
|
||||||
|
<Border Background="White"
|
||||||
|
CornerRadius="15"
|
||||||
|
BorderBrush="#4A90E2"
|
||||||
|
BorderThickness="2"
|
||||||
|
Padding="30">
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect Color="Black"
|
||||||
|
Direction="270"
|
||||||
|
ShadowDepth="3"
|
||||||
|
BlurRadius="10"
|
||||||
|
Opacity="0.3"/>
|
||||||
|
</Border.Effect>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 图标 -->
|
||||||
|
<Viewbox Grid.Row="0" Width="60" Height="60" Margin="0,0,0,20">
|
||||||
|
<Path Fill="#4CAF50"
|
||||||
|
Data="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4M11,16.5L6.5,12L7.91,10.59L11,13.67L16.59,8.09L18,9.5L11,16.5Z"/>
|
||||||
|
</Viewbox>
|
||||||
|
|
||||||
|
<!-- 消息文本 -->
|
||||||
|
<TextBlock Grid.Row="1"
|
||||||
|
Text="清洗完成!

感谢使用无人自动洗宠机"
|
||||||
|
FontSize="18"
|
||||||
|
FontWeight="Medium"
|
||||||
|
TextAlignment="Center"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
Foreground="#333333"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<!-- 倒计时文本 -->
|
||||||
|
<TextBlock Grid.Row="2"
|
||||||
|
x:Name="CountdownText"
|
||||||
|
Text="30秒后自动返回首页"
|
||||||
|
FontSize="14"
|
||||||
|
TextAlignment="Center"
|
||||||
|
Foreground="#666666"
|
||||||
|
Margin="0,20,0,15"/>
|
||||||
|
|
||||||
|
<!-- 确定按钮 -->
|
||||||
|
<Button Grid.Row="3"
|
||||||
|
Content="确定"
|
||||||
|
Click="OkButton_Click"
|
||||||
|
Height="40"
|
||||||
|
FontSize="16"
|
||||||
|
FontWeight="Medium"
|
||||||
|
Background="#4A90E2"
|
||||||
|
Foreground="White"
|
||||||
|
BorderThickness="0"
|
||||||
|
Cursor="Hand">
|
||||||
|
<Button.Style>
|
||||||
|
<Style TargetType="Button">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Border Background="{TemplateBinding Background}"
|
||||||
|
CornerRadius="8"
|
||||||
|
Padding="20,0">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="#357ABD"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Button.Style>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Window>
|
||||||
57
PetWashControl/Views/CompletionDialog.xaml.cs
Normal file
57
PetWashControl/Views/CompletionDialog.xaml.cs
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user