123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using Aitex.Core.UI.MVVM;
- using MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.OperationCenter;
- using OpenSEMI.ClientBase;
- using System.Collections.Generic;
- using System.Windows.Input;
- using MECF.Framework.Common.CommonData;
- using VirgoUI.Client.Models.Sys;
- namespace VirgoUI.Client.Models.Utility.EndPoint
- {
- class EndPointViewModel : ModuleUiViewModelBase, ISupportMultipleSystem
- {
- private int MenuPermission;
- public class AlogarithmTypeItem
- {
- public string AlogarithmName { get; set; }
- }
- public List<AlogarithmTypeItem> AlgorithmTypes { get; set; }
- public ICommand SaveCommand
- {
- get;
- private set;
- }
- public EndPointConfigItem ConfigItem
- {
- get;
- set;
- }
- public EndPointViewModel()
- {
- MenuPermission = ClientApp.Instance.GetPermission("epd");
- SaveCommand = new DelegateCommand<object>(SaveConfig);
- ConfigItem = new EndPointConfigItem();
- AlgorithmTypes = new List<AlogarithmTypeItem>()
- {
- new AlogarithmTypeItem() { AlogarithmName = "Unknown"},
- new AlogarithmTypeItem() { AlogarithmName = "Above_ABS_Value"},
- new AlogarithmTypeItem() { AlogarithmName = "Below_ABS_Value"},
- new AlogarithmTypeItem() { AlogarithmName = "Drop_Percent"},
- new AlogarithmTypeItem() { AlogarithmName = "Up_Percent"},
- new AlogarithmTypeItem() { AlogarithmName = "Range_In"},
- new AlogarithmTypeItem() { AlogarithmName = "Gradient"},
- new AlogarithmTypeItem() { AlogarithmName = "Peek"},
- new AlogarithmTypeItem() { AlogarithmName = "Valley"},
- new AlogarithmTypeItem() { AlogarithmName = "Min_Drop_Percent"},
- new AlogarithmTypeItem() { AlogarithmName = "Min_Up_Percent"},
- new AlogarithmTypeItem() { AlogarithmName = "Max_Drop_Percent"},
- new AlogarithmTypeItem() { AlogarithmName = "Max_Up_Percent"},
- new AlogarithmTypeItem() { AlogarithmName = "Rise_Fall"},
- new AlogarithmTypeItem() { AlogarithmName = "Fall_Rise"},
- };
- }
- protected override void OnActivate()
- {
- base.OnActivate();
- LoadConfig();
- }
- protected override void OnDeactivate(bool close)
- {
- base.OnDeactivate(close);
- }
- public void LoadConfig()
- {
- string config = (string)QueryDataClient.Instance.Service.GetConfig("System.EndPoint.EndPointDefaultValue");
- ConfigItem.SetValue(config);
- NotifyOfPropertyChange(nameof(ConfigItem));
- }
- void SaveConfig(object param)
- {
- if (MenuPermission != 3) return;
- InvokeClient.Instance.Service.DoOperation("System.SetConfig", "System.EndPoint.EndPointDefaultValue", ConfigItem.ToValue());
- }
- protected override void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
- {
- base.InvokeBeforeUpdateProperty(data);
- }
- }
- }
|