首次提交:添加src文件夹代码
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Communication.Interface;
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using System.Collections.ObjectModel;
|
||||
using Unity;
|
||||
|
||||
|
||||
namespace Cowain.Bake.UI.FactoryMaintenance.ViewModels
|
||||
{
|
||||
public class PLCVarMonitorViewModel : ViewModelBase
|
||||
{
|
||||
|
||||
IDialogService _dialogService;
|
||||
public ObservableCollection<IPLCDevice> plcList;
|
||||
public PLCVarMonitorViewModel(IUnityContainer unityContainer, IRegionManager regionManager, IDialogService dialogService)
|
||||
: base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "标签监视";
|
||||
_dialogService = dialogService;
|
||||
}
|
||||
|
||||
|
||||
public ObservableCollection<IPLCDevice> PlcList
|
||||
{
|
||||
get => plcList ?? (plcList = new ObservableCollection<IPLCDevice>());
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
// 用户信息刷新
|
||||
PlcList.Clear();
|
||||
var pList = _unityContainer.ResolveAll<IPLCDevice>();
|
||||
foreach (var item in pList)
|
||||
{
|
||||
PlcList.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
//public DelegateCommand<Variable> SelectScriptCommand => new DelegateCommand<Variable>((x) =>
|
||||
//{
|
||||
// DialogParameters param = new DialogParameters();
|
||||
// param.Add("variable", x);
|
||||
// _dialogService.ShowDialog(
|
||||
// "ScriptSelectDialog",
|
||||
// param,
|
||||
// result =>
|
||||
// {
|
||||
// if (result.Result == ButtonResult.OK)
|
||||
// {
|
||||
// this.Refresh();
|
||||
// }
|
||||
// });
|
||||
|
||||
//});
|
||||
|
||||
//public DelegateCommand<Variable> DeleteScriptCommand => new DelegateCommand<Variable>((x) =>
|
||||
//{
|
||||
// var result = HandyControl.Controls.MessageBox.Ask($@"是否确定要删除脚本关联?", "操作提示");
|
||||
// if (result == System.Windows.MessageBoxResult.Cancel)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// IPLCService service = _unityContainer.Resolve<IPLCService>();
|
||||
// int res = service.DelectScript(x);
|
||||
// if (res > 0)
|
||||
// {
|
||||
// Growl.Success("变量删除脚本关联成功!");
|
||||
// x.ScriptName = "";
|
||||
// x.ScriptId = 0;
|
||||
// this.Refresh();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Growl.Success("变量删除脚本关联失败,Id不存在!");
|
||||
// }
|
||||
|
||||
//});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user