增加了初始弹窗,但是没有成功
更改了CAN和LIN协调 更改了配置程序的名称顺序
This commit is contained in:
60
CapMachine.Wpf/ViewModels/HostDialogViewModel.cs
Normal file
60
CapMachine.Wpf/ViewModels/HostDialogViewModel.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using CapMachine.Wpf.Services;
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Services.Dialogs;
|
||||
using Prism.Ioc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public abstract class HostDialogViewModel : BindableBase, IHostDialogAware
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
||||
public string IdentifierName { get; set; }
|
||||
|
||||
public DelegateCommand SaveCommand { get; private set; }
|
||||
|
||||
public DelegateCommand CancelCommand { get; private set; }
|
||||
|
||||
private IHostDialogService dialogService;
|
||||
|
||||
public HostDialogViewModel()
|
||||
{
|
||||
SaveCommand = new DelegateCommand(async () => await Save());
|
||||
CancelCommand = new DelegateCommand(Cancel);
|
||||
|
||||
dialogService = ContainerLocator.Container.Resolve<IHostDialogService>();
|
||||
}
|
||||
|
||||
public virtual void Cancel()
|
||||
{
|
||||
dialogService.Close(IdentifierName, new DialogResult(ButtonResult.No));
|
||||
}
|
||||
|
||||
public virtual async Task Save()
|
||||
{
|
||||
dialogService.Close(IdentifierName, new DialogResult(ButtonResult.OK));
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
protected virtual void Save(object value)
|
||||
{
|
||||
DialogParameters param = new DialogParameters();
|
||||
param.Add("Value", value);
|
||||
|
||||
dialogService.Close(IdentifierName, new DialogResult(ButtonResult.OK, param));
|
||||
}
|
||||
|
||||
protected virtual void Save(DialogParameters param)
|
||||
{
|
||||
dialogService.Close(IdentifierName, new DialogResult(ButtonResult.OK, param));
|
||||
}
|
||||
|
||||
public abstract void OnDialogOpened(IDialogParameters parameters);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user