using Aitex.Core.Common.DeviceData; using Aitex.Core.Util; using DocumentFormat.OpenXml; using DocumentFormat.OpenXml.Drawing; using DocumentFormat.OpenXml.Wordprocessing; using FurnaceGasPanelUI.Models; using MECF.Framework.Common; using MECF.Framework.Common.DataCenter; using MECF.Framework.Common.OperationCenter; using MECF.Framework.UI.Client.ClientBase; using MECF.Framework.UI.Core.Control; using MECF.Framework.UI.Core.ExtendedControls; using OpenSEMI.ClientBase; using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Channels; using System.Text; using System.Threading.Tasks; using System.Windows; using MECF.Framework.UI.Core.DxfScript; using Aitex.Core.UI.Control; using DocumentFormat.OpenXml.Spreadsheet; using MECF.Framework.Common.Equipment; namespace FurnaceGasPanelUI.Views.Maintenances { public class GasXmlViewModel : ThermalGasPanelUIViewModelBase, MECF.Framework.Common.IUserFunctions { #region private string _PM = $"{ModuleName.PM1.ToString()}."; [Subscription("System.NameKeyDict")] public Dictionary> NameKeyDict { get; set; } public Window WinOwner { get; set; } private GasPanelStateType _selectedGasStateType = GasPanelStateType.Monitor; public GasPanelStateType SelectedGasStateType { get { return _selectedGasStateType; } set { _selectedGasStateType = value; NotifyOfPropertyChange(nameof(SelectedGasStateType)); } } #endregion public GasXmlViewModel() { UserFunctionsEvents.ClearAll(); UserFunctionsEvents.RegisterEvent>("SwichValue", SwichValue); UserFunctionsEvents.RegisterEvent>("ValveTouchUp", ValveTouchUp); UserFunctionsEvents.RegisterEvent>("MfcFlowTouchUp", MfcFlowTouchUp); } protected override void OnViewLoaded(object view) { base.OnViewLoaded(view); SwitchKey(); } protected override void InvokeAfterUpdateProperty(Dictionary data) { base.InvokeAfterUpdateProperty(data); GasMapProvider.GasMap.ModifyDrag(); } public void SelectedGasStateTypeCmd(string cmd) { switch (cmd) { case "Manual": SelectedGasStateType = GasPanelStateType.Manual; break; case "Monitor": SelectedGasStateType = GasPanelStateType.Monitor; break; case "Recipe": SelectedGasStateType = GasPanelStateType.Recipe; break; default: break; } SwitchKey(SelectedGasStateType == GasPanelStateType.Monitor); } /// /// 切换Key /// /// public void SwitchKey(bool isMonitor = true) { foreach (var item in GasMapProvider.GasMap.Valves) { var realKey = $"{ModuleName.PM1.ToString()}.{item.Name}.Feedback"; var recipeKey = $"{ModuleName.PM1.ToString()}.{item.Name}.VirtualStatus"; item.Key = isMonitor ? realKey : recipeKey; } foreach (var item in GasMapProvider.GasMap.Buttons) { bool isExextue = item.BoolCondition != null; var realKey = $"{ModuleName.PM1}.{item.InnerText.Text}Enable"; if (isExextue) { item.BoolCondition.Execute(); realKey = item.BoolCondition.ReadBoolValue().Item1; } item.DataKey = isMonitor ? realKey : realKey; } foreach (var item in GasMapProvider.GasMap.Analogs) { item.Brush = GasMapProvider.InitMFCColor; var realKey = $"{ModuleName.PM1}.{item.Name}.Feedback"; var recipeKey = $"{ModuleName.PM1}.{item.Name}.SetPoint"; item.ValueKey = isMonitor ? realKey : recipeKey; } foreach (var item in GasMapProvider.GasMap.Circles) { bool isExextue = item.ClickCondition == null && item.BoolCondition != null && item.StringCondition == null; if (isExextue) { item.BoolCondition.Execute(); item.Key = item.BoolCondition.ReadBoolValue().Item1; continue; } } } public void SetEnable(Dictionary parameter) { } public void SwichValue(Dictionary parameter) { } public void ValveTouchUp(Dictionary parameter) { } public void MfcFlowTouchUp(Dictionary parameter) { } } }