feat: 优化UI
This commit is contained in:
Binary file not shown.
BIN
PetWash.Api/petwash.db-shm
Normal file
BIN
PetWash.Api/petwash.db-shm
Normal file
Binary file not shown.
BIN
PetWash.Api/petwash.db-wal
Normal file
BIN
PetWash.Api/petwash.db-wal
Normal file
Binary file not shown.
@@ -70,3 +70,21 @@ public class InverseBoolToVisibilityConverter : IValueConverter
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class ProgressToWidthConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is int progress)
|
||||
{
|
||||
// 假设进度条容器宽度为300,根据百分比计算实际宽度
|
||||
return progress * 3.0; // 300px * (progress/100)
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
BIN
PetWashControl/Images/qrcode.png
Normal file
BIN
PetWashControl/Images/qrcode.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
BIN
PetWashControl/Images/unnamed.jpg
Normal file
BIN
PetWashControl/Images/unnamed.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 160 KiB |
@@ -16,4 +16,9 @@
|
||||
<PackageReference Include="System.Text.Json" Version="8.0.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\qrcode.png" />
|
||||
<Resource Include="Images\unnamed.jpg" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -65,6 +65,12 @@ public partial class MainViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<WashStep> _washSteps = new();
|
||||
|
||||
[ObservableProperty]
|
||||
private double _waterTemperature = 40.0;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _roomTemperature = 25.0;
|
||||
|
||||
public MainViewModel()
|
||||
{
|
||||
_config = new ConfigurationService();
|
||||
@@ -141,6 +147,15 @@ public partial class MainViewModel : ObservableObject
|
||||
_logger.LogInfo("切换到支付界面");
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void ShowSettings()
|
||||
{
|
||||
CurrentView = "Settings";
|
||||
ViewChanged?.Invoke("Settings");
|
||||
StatusMessage = "系统设置";
|
||||
_logger.LogInfo("切换到设置界面");
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void BackToIdle()
|
||||
{
|
||||
@@ -370,6 +385,9 @@ public partial class MainViewModel : ObservableObject
|
||||
int seconds = remaining % 60;
|
||||
RemainingTime = $"{minutes:D2}:{seconds:D2}";
|
||||
|
||||
// 模拟温度变化
|
||||
UpdateTemperatures(stepName, i, duration);
|
||||
|
||||
await Task.Delay(100); // 加速模拟,实际应为1000ms
|
||||
}
|
||||
}
|
||||
@@ -474,4 +492,52 @@ public partial class MainViewModel : ObservableObject
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void UpdateTemperatures(string stepName, int currentTime, int totalTime)
|
||||
{
|
||||
// 根据不同步骤模拟温度变化
|
||||
var random = new Random();
|
||||
double progress = (double)currentTime / totalTime;
|
||||
|
||||
switch (stepName)
|
||||
{
|
||||
case "第一次冲水":
|
||||
case "第二次冲水":
|
||||
case "第三次冲水":
|
||||
// 冲水阶段:水温在38-42度之间波动
|
||||
WaterTemperature = 40.0 + (random.NextDouble() - 0.5) * 4;
|
||||
RoomTemperature = 25.0 + (random.NextDouble() - 0.5) * 2;
|
||||
break;
|
||||
|
||||
case "沐浴露喷洒":
|
||||
case "香波喷洒":
|
||||
// 喷洒阶段:水温略低
|
||||
WaterTemperature = 38.0 + (random.NextDouble() - 0.5) * 2;
|
||||
RoomTemperature = 25.0 + (random.NextDouble() - 0.5) * 2;
|
||||
break;
|
||||
|
||||
case "热风吹毛":
|
||||
// 热风阶段:水温降低,室温升高
|
||||
WaterTemperature = 35.0 - progress * 10 + (random.NextDouble() - 0.5) * 2;
|
||||
RoomTemperature = 25.0 + progress * 8 + (random.NextDouble() - 0.5) * 2;
|
||||
break;
|
||||
|
||||
case "冷热风混合":
|
||||
// 混合风阶段:温度逐渐降低
|
||||
WaterTemperature = 25.0 + (random.NextDouble() - 0.5) * 2;
|
||||
RoomTemperature = 30.0 - progress * 5 + (random.NextDouble() - 0.5) * 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
// 默认温度
|
||||
WaterTemperature = 40.0 + (random.NextDouble() - 0.5) * 2;
|
||||
RoomTemperature = 25.0 + (random.NextDouble() - 0.5) * 2;
|
||||
break;
|
||||
}
|
||||
|
||||
// 确保温度在合理范围内
|
||||
WaterTemperature = Math.Max(20, Math.Min(45, WaterTemperature));
|
||||
RoomTemperature = Math.Max(20, Math.Min(35, RoomTemperature));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,7 @@ public partial class MainWindow : Window
|
||||
PaymentView.Visibility = Visibility.Collapsed;
|
||||
QRCodeView.Visibility = Visibility.Collapsed;
|
||||
WashingView.Visibility = Visibility.Collapsed;
|
||||
SettingsView.Visibility = Visibility.Collapsed;
|
||||
|
||||
// 显示指定视图
|
||||
switch (viewName)
|
||||
@@ -46,6 +47,9 @@ public partial class MainWindow : Window
|
||||
case "Washing":
|
||||
WashingView.Visibility = Visibility.Visible;
|
||||
break;
|
||||
case "Settings":
|
||||
SettingsView.Visibility = Visibility.Visible;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user