mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-08 02:25:35 +08:00
feat: 添加12306模拟认证失败提示
This commit is contained in:
@@ -80,7 +80,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="CRSim.WebsiteSimulator" Version="1.1.5" />
|
||||
<PackageReference Include="CRSim.WebsiteSimulator" Version="1.2.0" />
|
||||
<PackageReference Include="EPPlus" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.3" />
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace CRSim.ViewModels;
|
||||
|
||||
public partial class WebsiteSimulationPageViewModel : ObservableObject
|
||||
public partial class WebsiteSimulationPageViewModel(Simulator simulator, IDialogService dialogService) : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string _pageTitle = "12306模拟";
|
||||
@@ -10,16 +10,21 @@ public partial class WebsiteSimulationPageViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private string _pageDescription = "";
|
||||
|
||||
private Simulator _simulator;
|
||||
private readonly Simulator _simulator = simulator;
|
||||
|
||||
private readonly IDialogService _dialogService = dialogService;
|
||||
|
||||
public WebsiteSimulationPageViewModel(Simulator simulator)
|
||||
{
|
||||
_simulator = simulator;
|
||||
}
|
||||
[RelayCommand]
|
||||
public async Task StartSimulation()
|
||||
{
|
||||
await _simulator.Start();
|
||||
try
|
||||
{
|
||||
await _simulator.Start();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
_dialogService.ShowMessage("认证失败", e.Message);
|
||||
}
|
||||
}
|
||||
[RelayCommand]
|
||||
public void StopSimulation()
|
||||
|
||||
Reference in New Issue
Block a user