增加了初始弹窗,但是没有成功
更改了CAN和LIN协调 更改了配置程序的名称顺序
This commit is contained in:
41
CapMachine.Wpf/ViewModels/TaskBarViewModel.cs
Normal file
41
CapMachine.Wpf/ViewModels/TaskBarViewModel.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using CapMachine.Wpf.Services;
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Ioc;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public class TaskBarViewModel : BindableBase
|
||||
{
|
||||
private readonly IHostDialogService dialog;
|
||||
private readonly IAppStartService appStartService;
|
||||
public DelegateCommand ExitCommand { get; set; }
|
||||
public DelegateCommand ShowViewCommand { get; private set; }
|
||||
|
||||
public TaskBarViewModel()
|
||||
{
|
||||
dialog = ContainerLocator.Container.Resolve<IHostDialogService>();
|
||||
appStartService = ContainerLocator.Container.Resolve<IAppStartService>();
|
||||
|
||||
ExitCommand = new DelegateCommand(Exit);
|
||||
ShowViewCommand = new DelegateCommand(ShowView);
|
||||
}
|
||||
|
||||
private async void Exit()
|
||||
{
|
||||
ShowView();
|
||||
|
||||
if (await dialog.Question("确定","1"))
|
||||
appStartService.Exit();
|
||||
}
|
||||
|
||||
private void ShowView()
|
||||
{
|
||||
if (!App.Current.MainWindow.IsVisible)
|
||||
{
|
||||
App.Current.MainWindow.Show();
|
||||
App.Current.MainWindow.WindowState = System.Windows.WindowState.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user