using Caliburn.Micro; using Caliburn.Micro.Core; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using FurnaceUI.Models; namespace FurnaceUI.Views.Editors { public class RecipeRFPressureSettingViewModel : FurnaceUIViewModelBase { private string _rfSwitch = "0"; public string RFSwitch { get { return _rfSwitch; } set { _rfSwitch = value; NotifyOfPropertyChange("RFSwitch"); } } private string _rfSetPointValue = "0"; public string RFSetPointValue { get { return _rfSetPointValue; } set { _rfSetPointValue = value; NotifyOfPropertyChange("RFSetPointValue"); } } private string _c1SetPointValue = "0"; public string C1SetPointValue { get { return _c1SetPointValue; } set { _c1SetPointValue = value; NotifyOfPropertyChange("C1SetPointValue"); } } private string _c2SetPointValue = "0"; public string C2SetPointValue { get { return _c2SetPointValue; } set { _c2SetPointValue = value; NotifyOfPropertyChange("C2SetPointValue"); } } private string _c1AlarmWatchSetPointValue = "None"; public string C1AlarmWatchSetPointValue { get { return _c1AlarmWatchSetPointValue; } set { _c1AlarmWatchSetPointValue = value; NotifyOfPropertyChange("C1AlarmWatchSetPointValue"); } } private string _c2AlarmWatchSetPointValue = "None"; public string C2AlarmWatchSetPointValue { get { return _c2AlarmWatchSetPointValue; } set { _c2AlarmWatchSetPointValue = value; NotifyOfPropertyChange("C2AlarmWatchSetPointValue"); } } private string _forwardPowerAlarmWatchSetPointValue = "None"; public string ForwardPowerAlarmWatchSetPointValue { get { return _forwardPowerAlarmWatchSetPointValue; } set { _forwardPowerAlarmWatchSetPointValue = value; NotifyOfPropertyChange("ForwardPowerAlarmWatchSetPointValue"); } } private string _prAlarmWatchSetPointValue = "None"; public string PrAlarmWatchSetPointValue { get { return _prAlarmWatchSetPointValue; } set { _prAlarmWatchSetPointValue = value; NotifyOfPropertyChange("PrAlarmWatchSetPointValue"); } } private string _pIAlarmWatchSetPointValue = "None"; public string PIAlarmWatchSetPointValue { get { return _pIAlarmWatchSetPointValue; } set { _pIAlarmWatchSetPointValue = value; NotifyOfPropertyChange("PIAlarmWatchSetPointValue"); } } private string _vppAlarmWatchWatchSetPointValue = "None"; public string VppAlarmWatchSetPointValue { get { return _vppAlarmWatchWatchSetPointValue; } set { _vppAlarmWatchWatchSetPointValue = value; NotifyOfPropertyChange("VppAlarmWatchSetPointValue"); } } private string _vdcAlarmWatchSetPointValue = "None"; public string VdcAlarmWatchSetPointValue { get { return _vdcAlarmWatchSetPointValue; } set { _vdcAlarmWatchSetPointValue = value; NotifyOfPropertyChange("VdcAlarmWatchSetPointValue"); } } public string SetPointValue { get; set; } public string AlarmWatchTableValue { get; set; } public string RecipeSetPointValue { get; set; } public bool IsSwitchOnCheck { get; set; } public bool IsSwitchOffCheck { get; set; } protected override void OnActivate() { base.OnActivate(); IsSwitchOnCheck = RFSwitch == "On" ? true : false; IsSwitchOffCheck = !IsSwitchOnCheck; } public void RFSwitchCmd(string value) { IsSwitchOnCheck = value == "On" ? true : false; IsSwitchOffCheck = !IsSwitchOnCheck; RFSwitch = value == "On" ? "On" : "Off"; } public void RFSettingCmd(string value) { var windowManager = IoC.Get(); RecipeRFPressureSettingValueViewModel recipeRFPressureSettingValueViewModel = new RecipeRFPressureSettingValueViewModel(); recipeRFPressureSettingValueViewModel.SelectPressureValue = RFSetPointValue; switch (value) { case "RF": recipeRFPressureSettingValueViewModel.SetPointName = "RFPower"; break; case "C1": recipeRFPressureSettingValueViewModel.SetPointName = "MatchC1"; break; case "C2": recipeRFPressureSettingValueViewModel.SetPointName = "MatchC2"; break; } if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeRFPressureSettingValueViewModel, null, "SetPoint Setting")) { switch (value) { case "RF": RFSetPointValue = recipeRFPressureSettingValueViewModel.SelectPressureValue; break; case "C1": C1SetPointValue = recipeRFPressureSettingValueViewModel.SelectC1Value; break; case "C2": C2SetPointValue = recipeRFPressureSettingValueViewModel.SelectC2Value; break; } } } public void RFAlarmSettingCmd(string value) { var windowManager = IoC.Get(); RecipeRFAlarmTableSettingViewModel recipeRFAlarmTableSettingViewModel = new RecipeRFAlarmTableSettingViewModel(); switch (value) { case "C1 Alarm": recipeRFAlarmTableSettingViewModel.SetPointName = "C1AlarmWatch"; break; case "Vpp Alarm": recipeRFAlarmTableSettingViewModel.SetPointName = "VppAlarmWatch"; break; case "ForWardPower Alarm": recipeRFAlarmTableSettingViewModel.SetPointName = "ForwardPowerAlarmWatch"; break; case "Pr Alarm": recipeRFAlarmTableSettingViewModel.SetPointName = "PrAlarmWatch"; break; case "PI Alarm": recipeRFAlarmTableSettingViewModel.SetPointName = "PIAlarmWatch"; break; case "C2 Alarm": recipeRFAlarmTableSettingViewModel.SetPointName = "C2AlarmWatch"; break; case "Vdc Alarm": recipeRFAlarmTableSettingViewModel.SetPointName = "VdcAlarmWatch"; break; } if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeRFAlarmTableSettingViewModel, null, "SetPoint Setting")) { switch (value) { case "ForWardPower Alarm": ForwardPowerAlarmWatchSetPointValue = recipeRFAlarmTableSettingViewModel.SelectForwardPowerValue; break; case "Pr Alarm": PrAlarmWatchSetPointValue = recipeRFAlarmTableSettingViewModel.SelectPrAlarmWatchValue; break; case "PI Alarm": PIAlarmWatchSetPointValue = recipeRFAlarmTableSettingViewModel.SelectPIAlarmWatchValue; break; case "C1 Alarm": C1AlarmWatchSetPointValue = recipeRFAlarmTableSettingViewModel.SelectC1AlarmValue; break; case "C2 Alarm": C2AlarmWatchSetPointValue = recipeRFAlarmTableSettingViewModel.SelectC2AlarmValue; break; case "Vpp Alarm": VppAlarmWatchSetPointValue = recipeRFAlarmTableSettingViewModel.SelectVppAlarmWatchValue; break; case "Vdc Alarm": VdcAlarmWatchSetPointValue = recipeRFAlarmTableSettingViewModel.SelectVdcAlarmWatchValue; break; } } } public void SaveCmd() { ((Window)GetView()).DialogResult = true; } public void CloseCmd() { ((Window)GetView()).DialogResult = false; } } }