protected override void LoadPage(Page page) { if (page != null) { if (page.NavigationService != null) SelectedTabItem = PresentationUtility.GetLastTokenFromUri(page.NavigationService.CurrentSource); if (!string.IsNullOrEmpty(SelectedTabItem)) { var tab = page.FindName(SelectedTabItem) as TabItem; if (tab != null) { LoadSelectedTab(tab); PutFocusOnControl(tab); } } else { TabItem tab = GetdefaultTabItem(page); if(tab !=null) { LoadSelectedTab(tab); PutFocusOnControl(tab); } } } }
private void UpdateControlState(Page p1, string Tagname, string sControlType, string sControlName, string sPropertyName, int iValue, int pType, Tag t, bool bLogThisChange) { string sStatus = ""; string sName = ""; //Used for error class bool bConfigError = false; bool bControlDoesntExist = false; MyObjectInfo moi = t.MyObject as MyObjectInfo; switch (sControlType) { #region Airlock_MPSN case "Airlock_MPSN": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myAirlock_MPSN = (Airlock_MPSN)p1.FindName(sControlName); if (myAirlock_MPSN == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myAirlock_MPSN.MotorColor = iValue; sStatus = myAirlock_MPSN.Status_Motor; sName = myAirlock_MPSN.Name; myAirlock_MPSN.Description_Motor = moi.TagName + " " + moi.TagDescription; myAirlock_MPSN.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myAirlock_MPSN.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Airlock_MPSN_Cyclone case "Airlock_MPSN_Cyclone": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myAirlock_MPSN_Cyclone = (Airlock_MPSN_Cyclone)p1.FindName(sControlName); if (myAirlock_MPSN_Cyclone == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myAirlock_MPSN_Cyclone.MotorColor = iValue; sStatus = myAirlock_MPSN_Cyclone.Status_Motor; sName = myAirlock_MPSN_Cyclone.Name; myAirlock_MPSN_Cyclone.Description_Motor = moi.TagName + " " + moi.TagDescription; myAirlock_MPSN_Cyclone.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myAirlock_MPSN_Cyclone.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region AirValve1 case "AirValve1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myAirValve1 = (AirValve1)p1.FindName(sControlName); if (myAirValve1 == null) bControlDoesntExist = true; if (sPropertyName == "ValveColor") { myAirValve1.ValveColor = iValue; sStatus = myAirValve1.Status_Valve; sName = myAirValve1.Name; myAirValve1.Description_Valve = moi.TagName + " " + moi.TagDescription; myAirValve1.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myAirValve1.Fault_Valve; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Aspirator_MVSB case "Aspirator_MVSB": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myAspirator_MVSB = (Aspirator_MVSB)p1.FindName(sControlName); if (myAspirator_MVSB == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor1") { myAspirator_MVSB.MotorColor1 = iValue; sStatus = myAspirator_MVSB.Status_Motor1; sName = myAspirator_MVSB.Name; myAspirator_MVSB.Description_Motor1 = moi.TagName + " " + moi.TagDescription; myAspirator_MVSB.ObjectNumber1 = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myAspirator_MVSB.Fault_Motor1; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "MotorColor2") { myAspirator_MVSB.MotorColor2 = iValue; sStatus = myAspirator_MVSB.Status_Motor2; sName = myAspirator_MVSB.Name; myAspirator_MVSB.Description_Motor2 = moi.TagName + " " + moi.TagDescription; myAspirator_MVSB.ObjectNumber2 = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myAspirator_MVSB.Fault_Motor2; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Aspirator_MVSI case "Aspirator_MVSI": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myAspirator_MVSI = (Aspirator_MVSI)p1.FindName(sControlName); if (myAspirator_MVSI == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myAspirator_MVSI.MotorColor = iValue; sStatus = myAspirator_MVSI.Status_Motor; sName = myAspirator_MVSI.Name; myAspirator_MVSI.Description_Motor = moi.TagName + " " + moi.TagDescription; myAspirator_MVSI.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myAspirator_MVSI.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Auger_InSilo1 case "Auger_InSilo1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myAuger_InSilo1 = (Auger_InSilo1)p1.FindName(sControlName); if (myAuger_InSilo1 == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myAuger_InSilo1.MotorColor = iValue; sStatus = myAuger_InSilo1.Status_Conveyor; sName = myAuger_InSilo1.Name; myAuger_InSilo1.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myAuger_InSilo1.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myAuger_InSilo1.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Auger_Screw1 case "Auger_Screw1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myAuger_Screw1 = (Auger_Screw1)p1.FindName(sControlName); if (myAuger_Screw1 == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myAuger_Screw1.MotorColor = iValue; sStatus = myAuger_Screw1.Status_Conveyor; sName = myAuger_Screw1.Name; myAuger_Screw1.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myAuger_Screw1.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myAuger_Screw1.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region BaggingStation_BigBag case "BaggingStation_BigBag": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myBaggingStation_BigBag = (BaggingStation_BigBag)p1.FindName(sControlName); if (myBaggingStation_BigBag == null) bControlDoesntExist = true; if (sPropertyName == "BaggingStationColor") { myBaggingStation_BigBag.BaggingStationColor = iValue; sStatus = myBaggingStation_BigBag.Status_BaggingStation; sName = myBaggingStation_BigBag.Name; myBaggingStation_BigBag.Description_BaggingStation = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myBaggingStation_BigBag.Fault_BaggingStation; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Bagging_ClosingConveyor_MWTC case "Bagging_ClosingConveyor_MWTC": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myBagging_ClosingConveyor_MWTC = (Bagging_ClosingConveyor_MWTC)p1.FindName(sControlName); if (myBagging_ClosingConveyor_MWTC == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myBagging_ClosingConveyor_MWTC.MotorColor = iValue; sStatus = myBagging_ClosingConveyor_MWTC.Status_Conveyor; sName = myBagging_ClosingConveyor_MWTC.Name; myBagging_ClosingConveyor_MWTC.Description_Conveyor = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myBagging_ClosingConveyor_MWTC.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region BagginStation_MWPE case "BagginStation_MWPE": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myBagginStation_MWPE = (BagginStation_MWPE)p1.FindName(sControlName); if (myBagginStation_MWPE == null) bControlDoesntExist = true; if (sPropertyName == "BaggingStationColor") { myBagginStation_MWPE.BaggingStationColor = iValue; sStatus = myBagginStation_MWPE.Status_BaggingStation; sName = myBagginStation_MWPE.Name; myBagginStation_MWPE.Description_BaggingMachine = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myBagginStation_MWPE.Fault_BaggingStation; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region BaggingStation_MWPM case "BaggingStation_MWPM": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myBaggingStation_MWPM = (BaggingStation_MWPM)p1.FindName(sControlName); if (myBaggingStation_MWPM == null) bControlDoesntExist = true; if (sPropertyName == "BaggingStationColor") { myBaggingStation_MWPM.BaggingStationColor = iValue; sStatus = myBaggingStation_MWPM.Status_BaggingStation; sName = myBaggingStation_MWPM.Name; myBaggingStation_MWPM.Description_Monitor = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myBaggingStation_MWPM.Fault_BaggingStation; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region BaggingStation_RollTracks case "BaggingStation_RollTracks": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myBaggingStation_RollTracks = (BaggingStation_RollTracks)p1.FindName(sControlName); if (myBaggingStation_RollTracks == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myBaggingStation_RollTracks.MotorColor = iValue; sStatus = myBaggingStation_RollTracks.Status_Motor; sName = myBaggingStation_RollTracks.Name; myBaggingStation_RollTracks.Description_Motor = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myBaggingStation_RollTracks.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Bin_Vibro case "Bin_Vibro": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myBin_Vibro = (Bin_Vibro)p1.FindName(sControlName); if (myBin_Vibro == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myBin_Vibro.MotorColor = iValue; sStatus = myBin_Vibro.Status_Motor; sName = myBin_Vibro.Name; myBin_Vibro.Description_Motor = moi.TagName + " " + moi.TagDescription; myBin_Vibro.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myBin_Vibro.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region BlowThroughSievingMachine_MKZG case "BlowThroughSievingMachine_MKZG": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myBlowThroughSievingMachine_MKZG = (BlowThroughSievingMachine_MKZG)p1.FindName(sControlName); if (myBlowThroughSievingMachine_MKZG == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myBlowThroughSievingMachine_MKZG.MotorColor = iValue; sStatus = myBlowThroughSievingMachine_MKZG.Status_Motor; sName = myBlowThroughSievingMachine_MKZG.Name; myBlowThroughSievingMachine_MKZG.Description_Motor = moi.TagName + " " + moi.TagDescription; myBlowThroughSievingMachine_MKZG.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myBlowThroughSievingMachine_MKZG.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region BranFinisher_MKLA case "BranFinisher_MKLA": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myBranFinisher_MKLA = (BranFinisher_MKLA)p1.FindName(sControlName); if (myBranFinisher_MKLA == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myBranFinisher_MKLA.MotorColor = iValue; sStatus = myBranFinisher_MKLA.Status_BranFinisher; sName = myBranFinisher_MKLA.Name; myBranFinisher_MKLA.Description_BranFinisher = moi.TagName + " " + moi.TagDescription; myBranFinisher_MKLA.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myBranFinisher_MKLA.Fault_BranFinisher; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Bin_Discharger_MFPF case "Bin_Discharger_MFPF": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myBin_Discharger_MFPF = (Bin_Discharger_MFPF)p1.FindName(sControlName); if (myBin_Discharger_MFPF == null) bControlDoesntExist = true; if (sPropertyName == "DischargerColor") { myBin_Discharger_MFPF.DischargerColor = iValue; sStatus = myBin_Discharger_MFPF.Status_Discharger; sName = myBin_Discharger_MFPF.Name; myBin_Discharger_MFPF.Description_Discharger = moi.TagName + " " + moi.TagDescription; myBin_Discharger_MFPF.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myBin_Discharger_MFPF.Fault_Discharger; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region CombiCleaner_MTKB case "CombiCleaner_MTKB": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myCombiCleaner_MTKB = (CombiCleaner_MTKB)p1.FindName(sControlName); if (myCombiCleaner_MTKB == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myCombiCleaner_MTKB.MotorColor = iValue; sStatus = myCombiCleaner_MTKB.Status_Motor; sName = myCombiCleaner_MTKB.Name; myCombiCleaner_MTKB.Description_Motor = moi.TagName + " " + moi.TagDescription; myCombiCleaner_MTKB.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myCombiCleaner_MTKB.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region CompressedAir_SprayNozzle case "CompressedAir_SprayNozzle": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myCompressedAir_SprayNozzle = (CompressedAir_SprayNozzle)p1.FindName(sControlName); if (myCompressedAir_SprayNozzle == null) bControlDoesntExist = true; if (sPropertyName == "NozzleColor") { myCompressedAir_SprayNozzle.NozzleColor = iValue; sStatus = myCompressedAir_SprayNozzle.Status_Nozzle; sName = myCompressedAir_SprayNozzle.Name; myCompressedAir_SprayNozzle.Description_Nozzle = moi.TagName + " " + moi.TagDescription; myCompressedAir_SprayNozzle.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myCompressedAir_SprayNozzle.Fault_Nozzle; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Compressor case "Compressor": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myCompressor = (Compressor)p1.FindName(sControlName); if (myCompressor == null) bControlDoesntExist = true; if (sPropertyName == "CompressorColor") { myCompressor.CompressorColor = iValue; sStatus = myCompressor.Status_Compressor; sName = myCompressor.Name; myCompressor.Description_Compressor = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myCompressor.Fault_Compressor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Concentrator_MTCB case "Concentrator_MTCB": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConcentrator_MTCB = (Concentrator_MTCB)p1.FindName(sControlName); if (myConcentrator_MTCB == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConcentrator_MTCB.MotorColor = iValue; sStatus = myConcentrator_MTCB.Status_Motor; sName = myConcentrator_MTCB.Name; myConcentrator_MTCB.Description_Motor = moi.TagName + " " + moi.TagDescription; myConcentrator_MTCB.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConcentrator_MTCB.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion //ControlSieve_MKSA1 #region ControlSieve_MKSA1 case "ControlSieve_MKSA1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myControlSieve_MKSA1 = (ControlSieve_MKSA1)p1.FindName(sControlName); if (myControlSieve_MKSA1 == null) bControlDoesntExist = true; if (sPropertyName == "SieveColor") { myControlSieve_MKSA1.SieveColor = iValue; sStatus = myControlSieve_MKSA1.Status_Sieve; sName = myControlSieve_MKSA1.Name; myControlSieve_MKSA1.Description_Sieve = moi.TagName + " " + moi.TagDescription; myControlSieve_MKSA1.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myControlSieve_MKSA1.Fault_Sieve; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_BCTC case "Conveyor_BCTC": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_BCTC = (Conveyor_BCTC)p1.FindName(sControlName); if (myConveyor_BCTC == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor1") { myConveyor_BCTC.MotorColor1 = iValue; sStatus = myConveyor_BCTC.Status_Motor1; sName = myConveyor_BCTC.Name; myConveyor_BCTC.Description_Motor1 = moi.TagName + " " + moi.TagDescription; myConveyor_BCTC.ObjectNumber1 = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_BCTC.Fault_Motor1; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "MotorColor2") { myConveyor_BCTC.MotorColor2 = iValue; sStatus = myConveyor_BCTC.Status_Motor2; sName = myConveyor_BCTC.Name; myConveyor_BCTC.Description_Motor2 = moi.TagName + " " + moi.TagDescription; myConveyor_BCTC.ObjectNumber2 = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_BCTC.Fault_Motor2; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_Belt_XS case "Conveyor_Belt_XS": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_Belt_XS = (Conveyor_Belt_XS)p1.FindName(sControlName); if (myConveyor_Belt_XS == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_Belt_XS.MotorColor = iValue; sStatus = myConveyor_Belt_XS.Status_Conveyor; sName = myConveyor_Belt_XS.Name; myConveyor_Belt_XS.Description_Conveyor = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_Belt_XS.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_Belt_S case "Conveyor_Belt_S": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_Belt_S = (Conveyor_Belt_S)p1.FindName(sControlName); if (myConveyor_Belt_S == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_Belt_S.MotorColor = iValue; sStatus = myConveyor_Belt_S.Status_Conveyor; sName = myConveyor_Belt_S.Name; myConveyor_Belt_S.Description_Conveyor = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_Belt_S.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_Belt_M case "Conveyor_Belt_M": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_Belt_M = (Conveyor_Belt_M)p1.FindName(sControlName); if (myConveyor_Belt_M == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_Belt_M.MotorColor = iValue; sStatus = myConveyor_Belt_M.Status_Conveyor; sName = myConveyor_Belt_M.Name; myConveyor_Belt_M.Description_Conveyor = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_Belt_M.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_Chain_AHKA_L case "Conveyor_Chain_AHKA_L": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_Chain_AHKA_L = (Conveyor_Chain_AHKA_L)p1.FindName(sControlName); if (myConveyor_Chain_AHKA_L == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_Chain_AHKA_L.MotorColor = iValue; sStatus = myConveyor_Chain_AHKA_L.Status_Conveyor; sName = myConveyor_Chain_AHKA_L.Name; myConveyor_Chain_AHKA_L.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myConveyor_Chain_AHKA_L.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_Chain_AHKA_L.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_Chain_AHKA_M case "Conveyor_Chain_AHKA_M": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_Chain_AHKA_M = (Conveyor_Chain_AHKA_M)p1.FindName(sControlName); if (myConveyor_Chain_AHKA_M == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_Chain_AHKA_M.MotorColor = iValue; sStatus = myConveyor_Chain_AHKA_M.Status_Conveyor; sName = myConveyor_Chain_AHKA_M.Name; myConveyor_Chain_AHKA_M.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myConveyor_Chain_AHKA_M.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_Chain_AHKA_M.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_Chain_AHKA_S case "Conveyor_Chain_AHKA_S": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_Chain_AHKA_S = (Conveyor_Chain_AHKA_S)p1.FindName(sControlName); if (myConveyor_Chain_AHKA_S == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_Chain_AHKA_S.MotorColor = iValue; sStatus = myConveyor_Chain_AHKA_S.Status_Conveyor; sName = myConveyor_Chain_AHKA_S.Name; myConveyor_Chain_AHKA_S.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myConveyor_Chain_AHKA_S.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_Chain_AHKA_S.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_Chain_AHKA_XL case "Conveyor_Chain_AHKA_XL": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_Chain_AHKA_XL = (Conveyor_Chain_AHKA_XL)p1.FindName(sControlName); if (myConveyor_Chain_AHKA_XL == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_Chain_AHKA_XL.MotorColor = iValue; sStatus = myConveyor_Chain_AHKA_XL.Status_Conveyor; sName = myConveyor_Chain_AHKA_XL.Name; myConveyor_Chain_AHKA_XL.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myConveyor_Chain_AHKA_XL.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_Chain_AHKA_XL.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_Chain_AHKA_XXL case "Conveyor_Chain_AHKA_XXL": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_Chain_AHKA_XXL = (Conveyor_Chain_AHKA_XXL)p1.FindName(sControlName); if (myConveyor_Chain_AHKA_XXL == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_Chain_AHKA_XXL.MotorColor = iValue; sStatus = myConveyor_Chain_AHKA_XXL.Status_Conveyor; sName = myConveyor_Chain_AHKA_XXL.Name; myConveyor_Chain_AHKA_XXL.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myConveyor_Chain_AHKA_XXL.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_Chain_AHKA_XXL.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_LimitSwitch case "Conveyor_LimitSwitch": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_LimitSwitch = (Conveyor_LimitSwitch)p1.FindName(sControlName); if (myConveyor_LimitSwitch == null) bControlDoesntExist = true; if (sPropertyName == "LimitColor") { myConveyor_LimitSwitch.LimitColor = iValue; sStatus = myConveyor_LimitSwitch.Status_LimitSwitch; sName = myConveyor_LimitSwitch.Name; myConveyor_LimitSwitch.Description_LimitSwitch = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_LimitSwitch.Fault_LimitSwitch; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_MNSG_250 case "Conveyor_MNSG_250": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_MNSG_250 = (Conveyor_MNSG_250)p1.FindName(sControlName); if (myConveyor_MNSG_250 == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_MNSG_250.MotorColor = iValue; sStatus = myConveyor_MNSG_250.Status_Conveyor; sName = myConveyor_MNSG_250.Name; myConveyor_MNSG_250.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myConveyor_MNSG_250.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_MNSG_250.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_MZMA case "Conveyor_MZMA": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_MZMA = (Conveyor_MZMA)p1.FindName(sControlName); if (myConveyor_MZMA == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_MZMA.MotorColor = iValue; sStatus = myConveyor_MZMA.Status_Conveyor; sName = myConveyor_MZMA.Name; myConveyor_MZMA.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myConveyor_MZMA.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_MZMA.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_NFAS case "Conveyor_NFAS": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_NFAS = (Conveyor_NFAS)p1.FindName(sControlName); if (myConveyor_NFAS == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_NFAS.MotorColor = iValue; sStatus = myConveyor_NFAS.Status_Conveyor; sName = myConveyor_NFAS.Name; myConveyor_NFAS.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myConveyor_NFAS.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_NFAS.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_NFAS_M case "Conveyor_NFAS_M": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_NFAS_M = (Conveyor_NFAS_M)p1.FindName(sControlName); if (myConveyor_NFAS_M == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_NFAS_M.MotorColor = iValue; sStatus = myConveyor_NFAS_M.Status_Conveyor; sName = myConveyor_NFAS_M.Name; myConveyor_NFAS_M.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myConveyor_NFAS_M.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_NFAS_M.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_NFAS_L case "Conveyor_NFAS_L": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_NFAS_L = (Conveyor_NFAS_L)p1.FindName(sControlName); if (myConveyor_NFAS_L == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_NFAS_L.MotorColor = iValue; sStatus = myConveyor_NFAS_L.Status_Conveyor; sName = myConveyor_NFAS_L.Name; myConveyor_NFAS_L.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myConveyor_NFAS_L.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_NFAS_L.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_NFAS_250 case "Conveyor_NFAS_250": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_NFAS_250 = (Conveyor_NFAS_250)p1.FindName(sControlName); if (myConveyor_NFAS_250 == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_NFAS_250.MotorColor = iValue; sStatus = myConveyor_NFAS_250.Status_Conveyor; sName = myConveyor_NFAS_250.Name; myConveyor_NFAS_250.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myConveyor_NFAS_250.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_NFAS_250.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_NFAS_250Medium case "Conveyor_NFAS_250Medium": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_NFAS_250Medium = (Conveyor_NFAS_250Medium)p1.FindName(sControlName); if (myConveyor_NFAS_250Medium == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_NFAS_250Medium.MotorColor = iValue; sStatus = myConveyor_NFAS_250Medium.Status_Conveyor; sName = myConveyor_NFAS_250Medium.Name; myConveyor_NFAS_250Medium.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myConveyor_NFAS_250Medium.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_NFAS_250Medium.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_NFAS_250_L case "Conveyor_NFAS_250_L": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_NFAS_250_L = (Conveyor_NFAS_250_L)p1.FindName(sControlName); if (myConveyor_NFAS_250_L == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_NFAS_250_L.MotorColor = iValue; sStatus = myConveyor_NFAS_250_L.Status_Conveyor; sName = myConveyor_NFAS_250_L.Name; myConveyor_NFAS_250_L.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myConveyor_NFAS_250_L.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_NFAS_250_L.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_NFAS_250_XL case "Conveyor_NFAS_250_XL": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_NFAS_250_XL = (Conveyor_NFAS_250_XL)p1.FindName(sControlName); if (myConveyor_NFAS_250_XL == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myConveyor_NFAS_250_XL.MotorColor = iValue; sStatus = myConveyor_NFAS_250_XL.Status_Conveyor; sName = myConveyor_NFAS_250_XL.Name; myConveyor_NFAS_250_XL.Description_Conveyor = moi.TagName + " " + moi.TagDescription; myConveyor_NFAS_250_XL.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_NFAS_250_XL.Fault_Conveyor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_OverflowFlap case "Conveyor_OverflowFlap": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_OverflowFlap = (Conveyor_OverflowFlap)p1.FindName(sControlName); if (myConveyor_OverflowFlap == null) bControlDoesntExist = true; if (sPropertyName == "OverFlowColor") { myConveyor_OverflowFlap.OverFlowColor = iValue; sStatus = myConveyor_OverflowFlap.Status_Overflow; sName = myConveyor_OverflowFlap.Name; myConveyor_OverflowFlap.Description_Overflow = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_OverflowFlap.Fault_Overflow; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_SpeedMonitor_L case "Conveyor_SpeedMonitor_L": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_SpeedMonitor_L = (Conveyor_SpeedMonitor_L)p1.FindName(sControlName); if (myConveyor_SpeedMonitor_L == null) bControlDoesntExist = true; if (sPropertyName == "SpeedMonitorColor") { myConveyor_SpeedMonitor_L.SpeedMonitorColor = iValue; sStatus = myConveyor_SpeedMonitor_L.Status_SpeedMonitor; sName = myConveyor_SpeedMonitor_L.Name; myConveyor_SpeedMonitor_L.Description_SpeedMonitor = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_SpeedMonitor_L.Fault_SpeedMonitor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Conveyor_SpeedMonitor_R case "Conveyor_SpeedMonitor_R": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myConveyor_SpeedMonitor_R = (Conveyor_SpeedMonitor_R)p1.FindName(sControlName); if (myConveyor_SpeedMonitor_R == null) bControlDoesntExist = true; if (sPropertyName == "SpeedMonitorColor") { myConveyor_SpeedMonitor_R.SpeedMonitorColor = iValue; sStatus = myConveyor_SpeedMonitor_R.Status_SpeedMonitor; sName = myConveyor_SpeedMonitor_R.Name; myConveyor_SpeedMonitor_R.Description_SpeedMonitor = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myConveyor_SpeedMonitor_R.Fault_SpeedMonitor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region DampenerTurbolizer_MOZL case "DampenerTurbolizer_MOZL": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myDampenerTurbolizer_MOZL = (DampenerTurbolizer_MOZL)p1.FindName(sControlName); if (myDampenerTurbolizer_MOZL == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myDampenerTurbolizer_MOZL.MotorColor = iValue; sStatus = myDampenerTurbolizer_MOZL.Status_Dampener; sName = myDampenerTurbolizer_MOZL.Name; myDampenerTurbolizer_MOZL.Description_Dampener = moi.TagName + " " + moi.TagDescription; myDampenerTurbolizer_MOZL.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myDampenerTurbolizer_MOZL.Fault_Dampener; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region DeHuller case "DeHuller": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myDeHuller = (DeHuller)p1.FindName(sControlName); if (myDeHuller == null) bControlDoesntExist = true; if (sPropertyName == "DeHullerColor") { myDeHuller.DeHullerColor = iValue; sStatus = myDeHuller.Status_Dehuller; sName = myDeHuller.Name; myDeHuller.Description_Dehuller = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myDeHuller.Fault_Dehuller; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Degerminator_MHXM case "Degerminator_MHXM": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myDegerminator_MHXM = (Degerminator_MHXM)p1.FindName(sControlName); if (myDegerminator_MHXM == null) bControlDoesntExist = true; if (sPropertyName == "MotorColorMain") { myDegerminator_MHXM.MotorColorMain = iValue; sStatus = myDegerminator_MHXM.Status_MainMotor; sName = myDegerminator_MHXM.Name; myDegerminator_MHXM.Description_MainMotor = moi.TagName + " " + moi.TagDescription; myDegerminator_MHXM.ObjectNumber1 = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myDegerminator_MHXM.Fault_MainMotor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "MotorColorFan") { myDegerminator_MHXM.MotorColorFan = iValue; sStatus = myDegerminator_MHXM.Status_Fan; sName = myDegerminator_MHXM.Name; myDegerminator_MHXM.Description_Fan = moi.TagName + " " + moi.TagDescription; myDegerminator_MHXM.ObjectNumber2 = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myDegerminator_MHXM.Fault_Fan; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Destoner_MTSD case "Destoner_MTSD": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myDestoner_MTSD = (Destoner_MTSD)p1.FindName(sControlName); if (myDestoner_MTSD == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myDestoner_MTSD.MotorColor = iValue; sStatus = myDestoner_MTSD.Status_Destoner; sName = myDestoner_MTSD.Name; myDestoner_MTSD.Description_Destoner = moi.TagName + " " + moi.TagDescription; myDestoner_MTSD.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myDestoner_MTSD.Fault_Destoner; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Detacher_300G case "Detacher_300G": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myDetacher_300G = (Detacher_300G)p1.FindName(sControlName); if (myDetacher_300G == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myDetacher_300G.MotorColor = iValue; sStatus = myDetacher_300G.Status_Motor; sName = myDetacher_300G.Name; myDetacher_300G.Description_Motor = moi.TagName + " " + moi.TagDescription; myDetacher_300G.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myDetacher_300G.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Detacher_MJZF case "Detacher_MJZF": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myDetacher_MJZF = (Detacher_MJZF)p1.FindName(sControlName); if (myDetacher_MJZF == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myDetacher_MJZF.MotorColor = iValue; sStatus = myDetacher_MJZF.Status_Detacher; sName = myDetacher_MJZF.Name; myDetacher_MJZF.Description_Detacher = moi.TagName + " " + moi.TagDescription; myDetacher_MJZF.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myDetacher_MJZF.Fault_Detacher; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Detacher_MJZE case "Detacher_MJZE": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myDetacher_MJZE = (Detacher_MJZE)p1.FindName(sControlName); if (myDetacher_MJZE == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myDetacher_MJZE.MotorColor = iValue; sStatus = myDetacher_MJZE.Status_Detacher; sName = myDetacher_MJZE.Name; myDetacher_MJZE.Description_Detacher = moi.TagName + " " + moi.TagDescription; myDetacher_MJZE.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myDetacher_MJZE.Fault_Detacher; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Detacher_MJZF_Left case "Detacher_MJZF_Left": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myDetacher_MJZF_Left = (Detacher_MJZF_Left)p1.FindName(sControlName); if (myDetacher_MJZF_Left == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myDetacher_MJZF_Left.MotorColor = iValue; sStatus = myDetacher_MJZF_Left.Status_Detacher; sName = myDetacher_MJZF_Left.Name; myDetacher_MJZF_Left.Description_Detacher = moi.TagName + " " + moi.TagDescription; myDetacher_MJZF_Left.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myDetacher_MJZF_Left.Fault_Detacher; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region DrumSieve_AHCY case "DrumSieve_AHCY": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myDrumSieve_AHCY = (DrumSieve_AHCY)p1.FindName(sControlName); if (myDrumSieve_AHCY == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myDrumSieve_AHCY.MotorColor = iValue; sStatus = myDrumSieve_AHCY.Status_DrumSieve; sName = myDrumSieve_AHCY.Name; myDrumSieve_AHCY.Description_DrumSieve = moi.TagName + " " + moi.TagDescription; myDrumSieve_AHCY.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myDrumSieve_AHCY.Fault_DrumSieve; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Dryer_Aeroglide case "Dryer_Aeroglide": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myDryer_Aeroglide = (Dryer_Aeroglide)p1.FindName(sControlName); if (myDryer_Aeroglide == null) bControlDoesntExist = true; if (sPropertyName == "ColorDryer") { myDryer_Aeroglide.ColorDryer = iValue; sStatus = myDryer_Aeroglide.Status_Dryer; sName = myDryer_Aeroglide.Name; myDryer_Aeroglide.Description_Dryer = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myDryer_Aeroglide.Fault_Dryer; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Dryer_BeltDryer1 case "Dryer_BeltDryer1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myDryer_BeltDryer1 = (Dryer_BeltDryer1)p1.FindName(sControlName); if (myDryer_BeltDryer1 == null) bControlDoesntExist = true; if (sPropertyName == "ColorBelt1") { myDryer_BeltDryer1.ColorBelt1 = iValue; sStatus = myDryer_BeltDryer1.Status_Belt1; sName = myDryer_BeltDryer1.Name; myDryer_BeltDryer1.Description_Belt1 = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myDryer_BeltDryer1.Fault_Belt1; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region DustDetector1 case "DustDetector1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myDustDetector1 = (DustDetector1)p1.FindName(sControlName); if (myDustDetector1 == null) bControlDoesntExist = true; if (sPropertyName == "DustDetectorColor") { myDustDetector1.DustDetectorColor = iValue; sStatus = myDustDetector1.Status_DustDetector; sName = myDustDetector1.Name; myDustDetector1.Description_DustDetector = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myDustDetector1.Fault_DustDetector; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Elevator_L case "Elevator_L": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myElevator_L = (Elevator_L)p1.FindName(sControlName); if (myElevator_L == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myElevator_L.MotorColor = iValue; sStatus = myElevator_L.Status_Motor; sName = myElevator_L.Name; myElevator_L.Description_Motor = moi.TagName + " " + moi.TagDescription; myElevator_L.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myElevator_L.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "SpeedMonitorColorBottom") { myElevator_L.SpeedMonitorColorBottom = iValue; sStatus = myElevator_L.Status_SpeedMonitorBottom; sName = myElevator_L.Name; myElevator_L.Description_SpeedMonitorBottom = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myElevator_L.Fault_SpeedMonitorBottom; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "SpeedMonitorColorTop") { myElevator_L.SpeedMonitorColorTop = iValue; sStatus = myElevator_L.Status_SpeedMonitorTop; sName = myElevator_L.Name; myElevator_L.Description_SpeedMonitorTop = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myElevator_L.Fault_SpeedMonitorTop; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "BeltAlignmentColor1") { myElevator_L.BeltAlignmentColor1 = iValue; sName = myElevator_L.Name; } else if (sPropertyName == "BeltAlignmentColor2") { myElevator_L.BeltAlignmentColor2 = iValue; sName = myElevator_L.Name; } else if (sPropertyName == "BeltAlignmentColor3") { myElevator_L.BeltAlignmentColor3 = iValue; sName = myElevator_L.Name; } else if (sPropertyName == "BeltAlignmentColor4") { myElevator_L.BeltAlignmentColor4 = iValue; sName = myElevator_L.Name; } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Elevator_S case "Elevator_S": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myElevator_S = (Elevator_S)p1.FindName(sControlName); if (myElevator_S == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myElevator_S.MotorColor = iValue; sStatus = myElevator_S.Status_Motor; sName = myElevator_S.Name; myElevator_S.Description_Motor = moi.TagName + " " + moi.TagDescription; myElevator_S.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myElevator_S.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "SpeedMonitorColorBottom") { myElevator_S.SpeedMonitorColorBottom = iValue; sStatus = myElevator_S.Status_SpeedMonitorBottom; sName = myElevator_S.Name; myElevator_S.Description_SpeedMonitorBottom = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myElevator_S.Fault_SpeedMonitorBottom; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "SpeedMonitorColorTop") { myElevator_S.SpeedMonitorColorTop = iValue; sStatus = myElevator_S.Status_SpeedMonitorTop; sName = myElevator_S.Name; myElevator_S.Description_SpeedMonitorTop = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myElevator_S.Fault_SpeedMonitorTop; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "BeltAlignmentColor1") { myElevator_S.BeltAlignmentColor1 = iValue; sName = myElevator_S.Name; } else if (sPropertyName == "BeltAlignmentColor2") { myElevator_S.BeltAlignmentColor2 = iValue; sName = myElevator_S.Name; } else if (sPropertyName == "BeltAlignmentColor3") { myElevator_S.BeltAlignmentColor3 = iValue; sName = myElevator_S.Name; } else if (sPropertyName == "BeltAlignmentColor4") { myElevator_S.BeltAlignmentColor4 = iValue; sName = myElevator_S.Name; } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Elevator_M case "Elevator_M": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myElevator_M = (Elevator_M)p1.FindName(sControlName); if (myElevator_M == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myElevator_M.MotorColor = iValue; sStatus = myElevator_M.Status_Motor; sName = myElevator_M.Name; myElevator_M.Description_Motor = moi.TagName + " " + moi.TagDescription; myElevator_M.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myElevator_M.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "SpeedMonitorColorBottom") { myElevator_M.SpeedMonitorColorBottom = iValue; sStatus = myElevator_M.Status_SpeedMonitorBottom; sName = myElevator_M.Name; myElevator_M.Description_SpeedMonitorBottom = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myElevator_M.Fault_SpeedMonitorBottom; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "SpeedMonitorColorTop") { myElevator_M.SpeedMonitorColorTop = iValue; sStatus = myElevator_M.Status_SpeedMonitorTop; sName = myElevator_M.Name; myElevator_M.Description_SpeedMonitorTop = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myElevator_M.Fault_SpeedMonitorTop; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "BeltAlignmentColor1") { myElevator_M.BeltAlignmentColor1 = iValue; sName = myElevator_M.Name; } else if (sPropertyName == "BeltAlignmentColor2") { myElevator_M.BeltAlignmentColor2 = iValue; sName = myElevator_M.Name; } else if (sPropertyName == "BeltAlignmentColor3") { myElevator_M.BeltAlignmentColor3 = iValue; sName = myElevator_M.Name; } else if (sPropertyName == "BeltAlignmentColor4") { myElevator_M.BeltAlignmentColor4 = iValue; sName = myElevator_M.Name; } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Fan_Blower case "Fan_Blower": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myFan_Blower = (Fan_Blower)p1.FindName(sControlName); if (myFan_Blower == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myFan_Blower.MotorColor = iValue; sStatus = myFan_Blower.Status_Motor; sName = myFan_Blower.Name; myFan_Blower.Description_Motor = moi.TagName + " " + moi.TagDescription; myFan_Blower.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myFan_Blower.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Fan_HP case "Fan_HP": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myFan_HP = (Fan_HP)p1.FindName(sControlName); if (myFan_HP == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myFan_HP.MotorColor = iValue; sStatus = myFan_HP.Status_Motor; sName = myFan_HP.Name; myFan_HP.Description_Motor = moi.TagName + " " + moi.TagDescription; myFan_HP.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myFan_HP.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Fan_Normal case "Fan_Normal": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myFan_Normal = (Fan_Normal)p1.FindName(sControlName); if (myFan_Normal == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myFan_Normal.MotorColor = iValue; sStatus = myFan_Normal.Status_Motor; sName = myFan_Normal.Name; myFan_Normal.Description_Motor = moi.TagName + " " + moi.TagDescription; myFan_Normal.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myFan_Normal.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Feeder_LossInWeight_MSDF case "Feeder_LossInWeight_MSDF": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myFeeder_LossInWeight_MSDF = (Feeder_LossInWeight_MSDF)p1.FindName(sControlName); if (myFeeder_LossInWeight_MSDF == null) bControlDoesntExist = true; if (sPropertyName == "ColorFeeder") { myFeeder_LossInWeight_MSDF.ColorFeeder = iValue; sStatus = myFeeder_LossInWeight_MSDF.Status_Feeder; sName = myFeeder_LossInWeight_MSDF.Name; myFeeder_LossInWeight_MSDF.Description_Feeder = moi.TagName + " " + moi.TagDescription; myFeeder_LossInWeight_MSDF.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myFeeder_LossInWeight_MSDF.Fault_Feeder; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Feeder_MicroDifferential_1 case "Feeder_MicroDifferential_1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myFeeder_MicroDifferential_1 = (Feeder_MicroDifferential_1)p1.FindName(sControlName); if (myFeeder_MicroDifferential_1 == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myFeeder_MicroDifferential_1.MotorColor = iValue; sStatus = myFeeder_MicroDifferential_1.Status_Motor; sName = myFeeder_MicroDifferential_1.Name; myFeeder_MicroDifferential_1.Description_Motor = moi.TagName + " " + moi.TagDescription; myFeeder_MicroDifferential_1.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myFeeder_MicroDifferential_1.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Filter_MVRT case "Filter_MVRT": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myFilter_MVRT = (Filter_MVRT)p1.FindName(sControlName); if (myFilter_MVRT == null) bControlDoesntExist = true; if (sPropertyName == "FilterColor") { myFilter_MVRT.FilterColor = iValue; sStatus = myFilter_MVRT.Status_Filter; sName = myFilter_MVRT.Name; myFilter_MVRT.Description_Filter = moi.TagName + " " + moi.TagDescription; myFilter_MVRT.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myFilter_MVRT.Fault_Filter; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Filter_MVRU case "Filter_MVRU": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myFilter_MVRU = (Filter_MVRU)p1.FindName(sControlName); if (myFilter_MVRU == null) bControlDoesntExist = true; if (sPropertyName == "FilterColor") { myFilter_MVRU.FilterColor = iValue; sStatus = myFilter_MVRU.Status_Filter; sName = myFilter_MVRU.Name; myFilter_MVRU.Description_Filter = moi.TagName + " " + moi.TagDescription; myFilter_MVRU.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myFilter_MVRU.Fault_Filter; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Filter_MVRU_L case "Filter_MVRU_L": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myFilter_MVRU_L = (Filter_MVRU_L)p1.FindName(sControlName); if (myFilter_MVRU_L == null) bControlDoesntExist = true; if (sPropertyName == "FilterColor") { myFilter_MVRU_L.FilterColor = iValue; sStatus = myFilter_MVRU_L.Status_Filter; sName = myFilter_MVRU_L.Name; myFilter_MVRU_L.Description_Filter = moi.TagName + " " + moi.TagDescription; myFilter_MVRU_L.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myFilter_MVRU_L.Fault_Filter; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Filter_MVRU1 case "Filter_MVRU1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myFilter_MVRU1 = (Filter_MVRU1)p1.FindName(sControlName); if (myFilter_MVRU1 == null) bControlDoesntExist = true; if (sPropertyName == "FilterColor") { myFilter_MVRU1.FilterColor = iValue; sStatus = myFilter_MVRU1.Status_Filter; sName = myFilter_MVRU1.Name; myFilter_MVRU1.Description_Filter = moi.TagName + " " + moi.TagDescription; myFilter_MVRU1.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myFilter_MVRU1.Fault_Filter; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Flaker case "Flaker": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myFlaker = (Flaker)p1.FindName(sControlName); if (myFlaker == null) bControlDoesntExist = true; if (sPropertyName == "ColorFlaker") { myFlaker.ColorFlaker = iValue; sStatus = myFlaker.Status_Flaker; sName = myFlaker.Name; myFlaker.Description_Flaker = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myFlaker.Fault_Flaker; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "ColorFlakerMotor1") { myFlaker.ColorFlakerMotor1 = iValue; sStatus = myFlaker.Status_Flaker; sName = myFlaker.Name; myFlaker.Description_Flaker = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myFlaker.Fault_Flaker; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "ColorFlakerMotor2") { myFlaker.ColorFlakerMotor2 = iValue; sStatus = myFlaker.Status_Flaker; sName = myFlaker.Name; myFlaker.Description_Flaker = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myFlaker.Fault_Flaker; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region FlapBox case "FlapBox": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myFlapBox = (FlapBox)p1.FindName(sControlName); if (myFlapBox == null) bControlDoesntExist = true; if (sPropertyName == "FlapState") { myFlapBox.FlapState = iValue; sStatus = myFlapBox.Status_Flap; sName = myFlapBox.Name; myFlapBox.Description_Flap = moi.TagName + " " + moi.TagDescription; myFlapBox.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myFlapBox.Fault_Flap; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Flowbalancer case "Flowbalancer": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myFlowbalancer = (Flowbalancer)p1.FindName(sControlName); if (myFlowbalancer == null) bControlDoesntExist = true; if (sPropertyName == "FlowbalancerColor") { myFlowbalancer.FlowbalancerColor = iValue; sStatus = myFlowbalancer.Status_Flowbalancer; sName = myFlowbalancer.Name; myFlowbalancer.Description_Flowbalancer = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myFlowbalancer.Fault_Flowbalancer; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region FlowMeter1 case "FlowMeter1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myFlowMeter1 = (FlowMeter1)p1.FindName(sControlName); if (myFlowMeter1 == null) bControlDoesntExist = true; if (sPropertyName == "MeterColor") { myFlowMeter1.MeterColor = iValue; sStatus = myFlowMeter1.Status_Meter; sName = myFlowMeter1.Name; myFlowMeter1.Description_Meter = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myFlowMeter1.Fault_Meter; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region HammerMill_DFCQ case "HammerMill_DFCQ": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myHammerMill_DFCQ = (HammerMill_DFCQ)p1.FindName(sControlName); if (myHammerMill_DFCQ == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myHammerMill_DFCQ.MotorColor = iValue; sStatus = myHammerMill_DFCQ.Status_Motor; sName = myHammerMill_DFCQ.Name; myHammerMill_DFCQ.Description_Motor = moi.TagName + " " + moi.TagDescription; myHammerMill_DFCQ.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myHammerMill_DFCQ.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region HammerMill_DFCQ2 case "HammerMill_DFCQ2_Motor": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myHammerMill_DFCQ2_Motor = (HammerMill_DFCQ2_Motor)p1.FindName(sControlName); if (myHammerMill_DFCQ2_Motor == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myHammerMill_DFCQ2_Motor.MotorColor = iValue; sStatus = myHammerMill_DFCQ2_Motor.Status_Motor; sName = myHammerMill_DFCQ2_Motor.Name; myHammerMill_DFCQ2_Motor.Description_Motor = moi.TagName + " " + moi.TagDescription; myHammerMill_DFCQ2_Motor.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myHammerMill_DFCQ2_Motor.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region HammerMill_MJSA_MTSN case "HammerMill_MJSA_MTSN": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myHammerMill_MJSA_MTSN = (HammerMill_MJSA_MTSN)p1.FindName(sControlName); if (myHammerMill_MJSA_MTSN == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myHammerMill_MJSA_MTSN.MotorColor = iValue; sStatus = myHammerMill_MJSA_MTSN.Status_Motor; sName = myHammerMill_MJSA_MTSN.Name; myHammerMill_MJSA_MTSN.Description_Motor = moi.TagName + " " + moi.TagDescription; myHammerMill_MJSA_MTSN.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myHammerMill_MJSA_MTSN.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Hopper_BagIntake case "Hopper_BagIntake": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myHopperBagIntake = (Hopper_BagIntake)p1.FindName(sControlName); if (myHopperBagIntake == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myHopperBagIntake.MotorColor = iValue; sStatus = myHopperBagIntake.Status_Motor; sName = myHopperBagIntake.Name; myHopperBagIntake.ObjectNumber = moi.ObjectNo; myHopperBagIntake.Description_Motor = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myHopperBagIntake.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region IndentedSeperator_Mini case "IndentedSeperator_Mini": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myIndentedSeperator_Mini = (IndentedSeperator_Mini)p1.FindName(sControlName); if (myIndentedSeperator_Mini == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myIndentedSeperator_Mini.MotorColor = iValue; sStatus = myIndentedSeperator_Mini.Status_Motor; sName = myIndentedSeperator_Mini.Name; myIndentedSeperator_Mini.Description_Motor = moi.TagName + " " + moi.TagDescription; myIndentedSeperator_Mini.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myIndentedSeperator_Mini.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region IndentedSeparator_Mini1 case "IndentedSeparator_Mini1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myIndentedSeparator_Mini1 = (IndentedSeparator_Mini1)p1.FindName(sControlName); if (myIndentedSeparator_Mini1 == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myIndentedSeparator_Mini1.MotorColor = iValue; sStatus = myIndentedSeparator_Mini1.Status_Motor; sName = myIndentedSeparator_Mini1.Name; myIndentedSeparator_Mini1.Description_Motor = moi.TagName + " " + moi.TagDescription; myIndentedSeparator_Mini1.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myIndentedSeparator_Mini1.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region IndentedSeparator_MTRI case "IndentedSeparator_MTRI": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myIndentedSeparator_MTRI = (IndentedSeparator_MTRI)p1.FindName(sControlName); if (myIndentedSeparator_MTRI == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myIndentedSeparator_MTRI.MotorColor = iValue; sStatus = myIndentedSeparator_MTRI.Status_Motor; sName = myIndentedSeparator_MTRI.Name; myIndentedSeparator_MTRI.Description_Motor = moi.TagName + " " + moi.TagDescription; myIndentedSeparator_MTRI.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myIndentedSeparator_MTRI.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region KnockingHammer1 case "KnockingHammer1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myKnockingHammer1 = (KnockingHammer1)p1.FindName(sControlName); if (myKnockingHammer1 == null) bControlDoesntExist = true; if (sPropertyName == "HammerColor") { myKnockingHammer1.HammerColor = iValue; sStatus = myKnockingHammer1.Status_Hammer; sName = myKnockingHammer1.Name; myKnockingHammer1.Description_Hammer = moi.TagName + " " + moi.TagDescription; myKnockingHammer1.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myKnockingHammer1.Fault_Hammer; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Label_M case "Label_M": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myLabel_M = (Label_M)p1.FindName(sControlName); if (myLabel_M == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myLabel_M.MotorColor = iValue; sName = myLabel_M.Name; myLabel_M.Description_Motor = moi.TagName + " " + moi.TagDescription; } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Level_High_Bin case "Level_High_Bin": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myLevel_High_Bin = (Level_High_Bin)p1.FindName(sControlName); if (myLevel_High_Bin == null) bControlDoesntExist = true; if (sPropertyName == "LevelColor") { myLevel_High_Bin.LevelColor = iValue; sStatus = myLevel_High_Bin.Status_HighLevel; sName = myLevel_High_Bin.Name; myLevel_High_Bin.Description_HighLevel = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myLevel_High_Bin.Fault_HighLevel; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Level_High_Machine case "Level_High_Machine": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myLevel_High_Machine = (Level_High_Machine)p1.FindName(sControlName); if (myLevel_High_Machine == null) bControlDoesntExist = true; if (sPropertyName == "LevelColor") { myLevel_High_Machine.LevelColor = iValue; sStatus = myLevel_High_Machine.Status_HighLevel; sName = myLevel_High_Machine.Name; myLevel_High_Machine.Description_HighLevel = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myLevel_High_Machine.Fault_HighLevel; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Level_Mid case "Level_Mid": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myLevel_Mid = (Level_Mid)p1.FindName(sControlName); if (myLevel_Mid == null) bControlDoesntExist = true; if (sPropertyName == "SetColor") { myLevel_Mid.SetColor(iValue, pType); sStatus = myLevel_Mid.Status_MidLevel; sName = myLevel_Mid.Name; myLevel_Mid.Description_MidLevel = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myLevel_Mid.Fault_MidLevel; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Level_Low_Bin case "Level_Low_Bin": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myLevel_Low_Bin = (Level_Low_Bin)p1.FindName(sControlName); if (myLevel_Low_Bin == null) bControlDoesntExist = true; if (sPropertyName == "LevelColor") { myLevel_Low_Bin.LevelColor = iValue; sStatus = myLevel_Low_Bin.Status_LowLevel; sName = myLevel_Low_Bin.Name; myLevel_Low_Bin.Description_LowLevel = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myLevel_Low_Bin.Fault_LowLevel; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Level_Low_Machine case "Level_Low_Machine": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myLevel_Low_Machine = (Level_Low_Machine)p1.FindName(sControlName); if (myLevel_Low_Machine == null) bControlDoesntExist = true; if (sPropertyName == "LevelColor") { myLevel_Low_Machine.LevelColor = iValue; sStatus = myLevel_Low_Machine.Status_LowLevel; sName = myLevel_Low_Machine.Name; myLevel_Low_Machine.Description_LowLevel = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myLevel_Low_Machine.Fault_LowLevel; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Valve_Dosing1 case "Valve_Dosing1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myValve_Dosing1 = (Valve_Dosing1)p1.FindName(sControlName); if (myValve_Dosing1 == null) bControlDoesntExist = true; if (sPropertyName == "ValveColor") { myValve_Dosing1.ValveColor = iValue; sStatus = myValve_Dosing1.Status_Valve; sName = myValve_Dosing1.Name; myValve_Dosing1.Description_Valve = moi.TagName + " " + moi.TagDescription; myValve_Dosing1.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myValve_Dosing1.Fault_Valve; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Valve_MAUB case "Valve_MAUB": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myValve_MAUB = (Valve_MAUB)p1.FindName(sControlName); if (myValve_MAUB == null) bControlDoesntExist = true; if (sPropertyName == "ValveColor") { myValve_MAUB.ValveColor = iValue; sStatus = myValve_MAUB.Status_Valve; sName = myValve_MAUB.Name; myValve_MAUB.Description_Valve = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myValve_MAUB.Fault_Valve; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Magnet_Rotary1 case "Magnet_Rotary1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myMagnet_Rotary1 = (Magnet_Rotary1)p1.FindName(sControlName); if (myMagnet_Rotary1 == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myMagnet_Rotary1.MotorColor = iValue; sStatus = myMagnet_Rotary1.Status_Magnet_Rotary; sName = myMagnet_Rotary1.Name; myMagnet_Rotary1.Description_Magnet_Rotary = moi.TagName + " " + moi.TagDescription; myMagnet_Rotary1.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myMagnet_Rotary1.Fault_Magnet_Rotary; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Mixer_DFML1000 case "Mixer_DFML1000": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myMixer_DFML1000 = (Mixer_DFML1000)p1.FindName(sControlName); if (myMixer_DFML1000 == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myMixer_DFML1000.MotorColor = iValue; sStatus = myMixer_DFML1000.Status_Motor; sName = myMixer_DFML1000.Name; myMixer_DFML1000.Description_Motor = moi.TagName + " " + moi.TagDescription; myMixer_DFML1000.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myMixer_DFML1000.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region MixerDoor1 case "MixerDoor1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myMixerDoor1 = (MixerDoor1)p1.FindName(sControlName); if (myMixerDoor1 == null) bControlDoesntExist = true; if (sPropertyName == "SlideColor") { myMixerDoor1.SlideColor = iValue; sStatus = myMixerDoor1.Status_Slide; sName = myMixerDoor1.Name; myMixerDoor1.Description_Slide = moi.TagName + " " + moi.TagDescription; myMixerDoor1.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myMixerDoor1.Fault_Slide; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Monitor_Alarm1 case "Monitor_Alarm1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myMonitor_Alarm1 = (Monitor_Alarm1)p1.FindName(sControlName); if (myMonitor_Alarm1 == null) bControlDoesntExist = true; if (sPropertyName == "MonitorColor") { myMonitor_Alarm1.MonitorColor = iValue; sStatus = myMonitor_Alarm1.Status_Alarm; sName = myMonitor_Alarm1.Name; myMonitor_Alarm1.Description_Alarm = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myMonitor_Alarm1.Fault_Alarm; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Monitor_SifterOutlet case "Monitor_SifterOutlet": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myMonitor_SifterOutlet = (Monitor_SifterOutlet)p1.FindName(sControlName); if (myMonitor_SifterOutlet == null) bControlDoesntExist = true; if (sPropertyName == "MonitorColor") { myMonitor_SifterOutlet.MonitorColor = iValue; sStatus = myMonitor_SifterOutlet.Status_Monitor; sName = myMonitor_SifterOutlet.Name; myMonitor_SifterOutlet.Description_Monitor = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myMonitor_SifterOutlet.Fault_Monitor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Monitor_Stroke case "Monitor_Stroke": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myMonitor_Stroke = (Monitor_Stroke)p1.FindName(sControlName); if (myMonitor_Stroke == null) bControlDoesntExist = true; if (sPropertyName == "MonitorColor") { myMonitor_Stroke.MonitorColor = iValue; sStatus = myMonitor_Stroke.Status_Monitor; sName = myMonitor_Stroke.Name; myMonitor_Stroke.Description_Monitor = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myMonitor_Stroke.Fault_Monitor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region MOZF case "MOZF": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myMOZF = (MOZF)p1.FindName(sControlName); if (myMOZF == null) bControlDoesntExist = true; if (sPropertyName == "MOZFColor") { myMOZF.MOZFColor = iValue; sStatus = myMOZF.Status_MOZF; sName = myMOZF.Name; myMOZF.Description_MOZF = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myMOZF.Fault_MOZF; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region MYFC case "MYFC": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myMYFC = (MYFC)p1.FindName(sControlName); if (myMYFC == null) bControlDoesntExist = true; if (sPropertyName == "MYFCColor") { myMYFC.MYFCColor = iValue; sStatus = myMYFC.Status_MYFC; sName = myMYFC.Name; myMYFC.Description_MYFC = moi.TagName + " " + moi.TagDescription; myMYFC.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myMYFC.Fault_MYFC; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region OTWDryer case "OTWDryer": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myOTWDryer = (OTWDryer)p1.FindName(sControlName); if (myOTWDryer == null) bControlDoesntExist = true; if (sPropertyName == "BeltMotorColor") { myOTWDryer.BeltMotorColor = iValue; sStatus = myOTWDryer.Status_BeltMotor; sName = myOTWDryer.Name; myOTWDryer.Description_BeltMotor = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myOTWDryer.Fault_BeltMotor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "PulsatorMotorColor") { myOTWDryer.PulsatorMotorColor = iValue; sStatus = myOTWDryer.Status_PulsatorMotor; sName = myOTWDryer.Name; myOTWDryer.Description_PulsatorMotor = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myOTWDryer.Fault_PulsatorMotor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region PowerMill_MDGB case "PowerMill_MDGB": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myPowerMill_MDGB = (PowerMill_MDGB)p1.FindName(sControlName); if (myPowerMill_MDGB == null) bControlDoesntExist = true; if (sPropertyName == "DetacherColor") { myPowerMill_MDGB.DetacherColor = iValue; sStatus = myPowerMill_MDGB.Status_Detacher; sName = myPowerMill_MDGB.Name; myPowerMill_MDGB.Description_Detacher = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myPowerMill_MDGB.Fault_Detacher; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "HydraulicPumpColor") { myPowerMill_MDGB.HydraulicPumpColor = iValue; sStatus = myPowerMill_MDGB.Status_HydraulicPump; sName = myPowerMill_MDGB.Name; myPowerMill_MDGB.Description_HydraulicPump = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myPowerMill_MDGB.Fault_HydraulicPump; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "LeftRollColor") { myPowerMill_MDGB.LeftRollColor = iValue; sStatus = myPowerMill_MDGB.Status_LeftRoll; sName = myPowerMill_MDGB.Name; myPowerMill_MDGB.Description_LeftRoll = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myPowerMill_MDGB.Fault_LeftRoll; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "RightRollColor") { myPowerMill_MDGB.RightRollColor = iValue; sStatus = myPowerMill_MDGB.Status_RightRoll; sName = myPowerMill_MDGB.Name; myPowerMill_MDGB.Description_RightRoll = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myPowerMill_MDGB.Fault_RightRoll; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Purifier_MQRF case "Purifier_MQRF": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myPurifier_MQRF = (Purifier_MQRF)p1.FindName(sControlName); if (myPurifier_MQRF == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myPurifier_MQRF.MotorColor = iValue; sStatus = myPurifier_MQRF.Status_Purifier; sName = myPurifier_MQRF.Name; myPurifier_MQRF.Description_Purifier = moi.TagName + " " + moi.TagDescription; myPurifier_MQRF.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myPurifier_MQRF.Fault_Purifier; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Purifier_MQRF1 case "Purifier_MQRF1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myPurifier_MQRF1 = (Purifier_MQRF1)p1.FindName(sControlName); if (myPurifier_MQRF1 == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myPurifier_MQRF1.MotorColor = iValue; sStatus = myPurifier_MQRF1.Status_Purifier; sName = myPurifier_MQRF1.Name; myPurifier_MQRF1.Description_Purifier = moi.TagName + " " + moi.TagDescription; myPurifier_MQRF1.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myPurifier_MQRF1.Fault_Purifier; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Purifier_MQRF_SideView case "Purifier_MQRF_SideView": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myPurifier_MQRF_SideView = (Purifier_MQRF_SideView)p1.FindName(sControlName); if (myPurifier_MQRF_SideView == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myPurifier_MQRF_SideView.MotorColor = iValue; sStatus = myPurifier_MQRF_SideView.Status_Purifier; sName = myPurifier_MQRF_SideView.Name; myPurifier_MQRF_SideView.Description_Purifier = moi.TagName + " " + moi.TagDescription; myPurifier_MQRF_SideView.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myPurifier_MQRF_SideView.Fault_Purifier; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region RollerStand_Engage case "RollerStand_Engage": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myRollerStand_Engage = (RollerStand_Engage)p1.FindName(sControlName); if (myRollerStand_Engage == null) bControlDoesntExist = true; if (sPropertyName == "EngageColor") { myRollerStand_Engage.EngageColor = iValue; sStatus = myRollerStand_Engage.Status_Engage; sName = myRollerStand_Engage.Name; myRollerStand_Engage.Description_Engage = moi.TagName + " " + moi.TagDescription; myRollerStand_Engage.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myRollerStand_Engage.Fault_Engage; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region RollerStand_MDDQ case "RollerStand_MDDQ": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myRollerStand_MDDQ = (RollerStand_MDDQ)p1.FindName(sControlName); if (myRollerStand_MDDQ == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor1") { myRollerStand_MDDQ.MotorColor1 = iValue; sStatus = myRollerStand_MDDQ.Status_Motor1; sName = myRollerStand_MDDQ.Name; myRollerStand_MDDQ.Description_Motor1 = moi.TagName + " " + moi.TagDescription; myRollerStand_MDDQ.ObjectNumber1 = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myRollerStand_MDDQ.Fault_Motor1; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "MotorColor2") { myRollerStand_MDDQ.MotorColor2 = iValue; sStatus = myRollerStand_MDDQ.Status_Motor2; sName = myRollerStand_MDDQ.Name; myRollerStand_MDDQ.Description_Motor2 = moi.TagName + " " + moi.TagDescription; myRollerStand_MDDQ.ObjectNumber2 = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myRollerStand_MDDQ.Fault_Motor2; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } if (sPropertyName == "MotorColor3") { myRollerStand_MDDQ.MotorColor3 = iValue; sStatus = myRollerStand_MDDQ.Status_Motor3; sName = myRollerStand_MDDQ.Name; myRollerStand_MDDQ.Description_Motor3 = moi.TagName + " " + moi.TagDescription; myRollerStand_MDDQ.ObjectNumber3 = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myRollerStand_MDDQ.Fault_Motor3; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "MotorColor4") { myRollerStand_MDDQ.MotorColor4 = iValue; sStatus = myRollerStand_MDDQ.Status_Motor4; sName = myRollerStand_MDDQ.Name; myRollerStand_MDDQ.Description_Motor4 = moi.TagName + " " + moi.TagDescription; myRollerStand_MDDQ.ObjectNumber4 = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myRollerStand_MDDQ.Fault_Motor4; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "FrequencyConverter_ColorSide1") { myRollerStand_MDDQ.FrequencyConverter_ColorSide1 = iValue; sStatus = myRollerStand_MDDQ.Status_FrequencyConverter1; sName = myRollerStand_MDDQ.Name; myRollerStand_MDDQ.Description_FrequencyConverter1 = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myRollerStand_MDDQ.Fault_FrequencyConverter1; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "FrequencyConverter_ColorSide2") { myRollerStand_MDDQ.FrequencyConverter_ColorSide2 = iValue; sStatus = myRollerStand_MDDQ.Status_FrequencyConverter2; sName = myRollerStand_MDDQ.Name; myRollerStand_MDDQ.Description_FrequencyConverter2 = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myRollerStand_MDDQ.Fault_FrequencyConverter2; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region RollerStand_MDDR case "RollerStand_MDDR": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myRollerStand_MDDR = (RollerStand_MDDR)p1.FindName(sControlName); if (myRollerStand_MDDR == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor1") { myRollerStand_MDDR.MotorColor1 = iValue; sStatus = myRollerStand_MDDR.Status_Motor1; sName = myRollerStand_MDDR.Name; myRollerStand_MDDR.Description_Motor1 = moi.TagName + " " + moi.TagDescription; myRollerStand_MDDR.ObjectNumber1 = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myRollerStand_MDDR.Fault_Motor1; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "MotorColor2") { myRollerStand_MDDR.MotorColor2 = iValue; sStatus = myRollerStand_MDDR.Status_Motor2; sName = myRollerStand_MDDR.Name; myRollerStand_MDDR.Description_Motor2 = moi.TagName + " " + moi.TagDescription; myRollerStand_MDDR.ObjectNumber2 = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myRollerStand_MDDR.Fault_Motor2; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "FrequencyConverter_ColorSide1") { myRollerStand_MDDR.FrequencyConverter_ColorSide1 = iValue; sStatus = myRollerStand_MDDR.Status_FrequencyConverter1; sName = myRollerStand_MDDR.Name; myRollerStand_MDDR.Description_FrequencyConverter1 = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myRollerStand_MDDR.Fault_FrequencyConverter1; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "FrequencyConverter_ColorSide2") { myRollerStand_MDDR.FrequencyConverter_ColorSide2 = iValue; sStatus = myRollerStand_MDDR.Status_FrequencyConverter2; sName = myRollerStand_MDDR.Name; myRollerStand_MDDR.Description_FrequencyConverter2 = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myRollerStand_MDDR.Fault_FrequencyConverter2; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region RotarySpout_MAYV case "RotarySpout_MAYV": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myRotarySpout_MAYV = (RotarySpout_MAYV)p1.FindName(sControlName); if (myRotarySpout_MAYV == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myRotarySpout_MAYV.MotorColor = iValue; sStatus = myRotarySpout_MAYV.Status_RotarySpout; sName = myRotarySpout_MAYV.Name; myRotarySpout_MAYV.Description_RotarySpout = moi.TagName + " " + moi.TagDescription; myRotarySpout_MAYV.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myRotarySpout_MAYV.Fault_RotarySpout; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Scale_Dosing case "Scale_Dosing": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myScale_Dosing = (Scale_Dosing)p1.FindName(sControlName); if (myScale_Dosing == null) bControlDoesntExist = true; if (sPropertyName == "ScaleColor") { myScale_Dosing.ScaleColor = iValue; sStatus = myScale_Dosing.Status_Scale; sName = myScale_Dosing.Name; myScale_Dosing.Description_Scale = moi.TagName + " " + moi.TagDescription; myScale_Dosing.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myScale_Dosing.Fault_Scale; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Scale_Dosing1 case "Scale_Dosing1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myScale_Dosing1 = (Scale_Dosing1)p1.FindName(sControlName); if (myScale_Dosing1 == null) bControlDoesntExist = true; if (sPropertyName == "ScaleColor") { myScale_Dosing1.ScaleColor = iValue; sStatus = myScale_Dosing1.Status_Scale; sName = myScale_Dosing1.Name; myScale_Dosing1.Description_Scale = moi.TagName + " " + moi.TagDescription; myScale_Dosing1.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myScale_Dosing1.Fault_Scale; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Scale_MSDM case "Scale_MSDM": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myScale_MSDM = (Scale_MSDM)p1.FindName(sControlName); if (myScale_MSDM == null) bControlDoesntExist = true; if (sPropertyName == "ScaleColor") { myScale_MSDM.ScaleColor = iValue; sStatus = myScale_MSDM.Status_Scale; sName = myScale_MSDM.Name; myScale_MSDM.Description_Scale = moi.TagName + " " + moi.TagDescription; myScale_MSDM.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myScale_MSDM.Fault_Scale; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Scale_MSDT500 case "Scale_MSDT500": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myScale_MSDT500 = (Scale_MSDT500)p1.FindName(sControlName); if (myScale_MSDT500 == null) bControlDoesntExist = true; if (sPropertyName == "ScaleColor") { myScale_MSDT500.ScaleColor = iValue; sStatus = myScale_MSDT500.Status_Scale; sName = myScale_MSDT500.Name; myScale_MSDT500.Description_Scale = moi.TagName + " " + moi.TagDescription; myScale_MSDT500.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myScale_MSDT500.Fault_Scale; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region ScaleCentral_MSBA_A500 case "ScaleCentral_MSBA_A500": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myScaleCentral_MSBA_A500 = (ScaleCentral_MSBA_A500)p1.FindName(sControlName); if (myScaleCentral_MSBA_A500 == null) bControlDoesntExist = true; if (sPropertyName == "ScaleColor") { myScaleCentral_MSBA_A500.ScaleColor = iValue; sStatus = myScaleCentral_MSBA_A500.Status_Scale; sName = myScaleCentral_MSBA_A500.Name; myScaleCentral_MSBA_A500.Description_Scale = moi.TagName + " " + moi.TagDescription; myScaleCentral_MSBA_A500.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myScaleCentral_MSBA_A500.Fault_Scale; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Scourer_MHXT case "Scourer_MHXT": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myScourer_MHXT = (Scourer_MHXT)p1.FindName(sControlName); if (myScourer_MHXT == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myScourer_MHXT.MotorColor = iValue; sStatus = myScourer_MHXT.Status_Scourer; sName = myScourer_MHXT.Name; myScourer_MHXT.Description_Scourer = moi.TagName + " " + moi.TagDescription; myScourer_MHXT.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myScourer_MHXT.Fault_Scourer; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Separator_MANB case "Separator_MANB": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySeparator_MANB = (Separator_MANB)p1.FindName(sControlName); if (mySeparator_MANB == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { mySeparator_MANB.MotorColor = iValue; sStatus = mySeparator_MANB.Status_Motor; sName = mySeparator_MANB.Name; mySeparator_MANB.Description_Motor = moi.TagName + " " + moi.TagDescription; mySeparator_MANB.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySeparator_MANB.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Separator_MTRC case "Separator_MTRC": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySeparator_MTRC = (Separator_MTRC)p1.FindName(sControlName); if (mySeparator_MTRC == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { mySeparator_MTRC.MotorColor = iValue; sStatus = mySeparator_MTRC.Status_Separator; sName = mySeparator_MTRC.Name; mySeparator_MTRC.Description_Separator = moi.TagName + " " + moi.TagDescription; mySeparator_MTRC.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySeparator_MTRC.Fault_Separator; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Sieve_1 case "Sieve_1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySieve_1 = (Sieve_1)p1.FindName(sControlName); if (mySieve_1 == null) bControlDoesntExist = true; if (sPropertyName == "SieveColor") { mySieve_1.SieveColor = iValue; sStatus = mySieve_1.Status_Sieve; sName = mySieve_1.Name; mySieve_1.Description_Sieve = moi.TagName + " " + moi.TagDescription; mySieve_1.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySieve_1.Fault_Sieve; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region SievingMachine_MKZF case "SievingMachine_MKZF": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySievingMachine_MKZF = (SievingMachine_MKZF)p1.FindName(sControlName); if (mySievingMachine_MKZF == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { mySievingMachine_MKZF.MotorColor = iValue; sStatus = mySievingMachine_MKZF.Status_Motor; sName = mySievingMachine_MKZF.Name; mySievingMachine_MKZF.Description_Motor = moi.TagName + " " + moi.TagDescription; mySievingMachine_MKZF.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySievingMachine_MKZF.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Sifter_MPAK case "Sifter_MPAK": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySifter_MPAK = (Sifter_MPAK)p1.FindName(sControlName); if (mySifter_MPAK == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { mySifter_MPAK.MotorColor = iValue; sStatus = mySifter_MPAK.Status_Sifter; sName = mySifter_MPAK.Name; mySifter_MPAK.Description_Sifter = moi.TagName + " " + moi.TagDescription; mySifter_MPAK.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySifter_MPAK.Fault_Sifter; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Sifter_MPAK2 case "Sifter_MPAK2": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySifter_MPAK2 = (Sifter_MPAK2)p1.FindName(sControlName); if (mySifter_MPAK2 == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { mySifter_MPAK2.MotorColor = iValue; sStatus = mySifter_MPAK2.Status_Sifter; sName = mySifter_MPAK2.Name; mySifter_MPAK2.Description_Sifter = moi.TagName + " " + moi.TagDescription; mySifter_MPAK2.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySifter_MPAK2.Fault_Sifter; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Sifter_MPAP3 case "Sifter_MPAP3": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySifter_MPAP3 = (Sifter_MPAP3)p1.FindName(sControlName); if (mySifter_MPAP3 == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { mySifter_MPAP3.MotorColor = iValue; sStatus = mySifter_MPAP3.Status_Sifter; sName = mySifter_MPAP3.Name; mySifter_MPAP3.Description_Sifter = moi.TagName + " " + moi.TagDescription; mySifter_MPAP3.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySifter_MPAP3.Fault_Sifter; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Sifter_MPAP4 case "Sifter_MPAP4": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySifter_MPAP4 = (Sifter_MPAP4)p1.FindName(sControlName); if (mySifter_MPAP4 == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { mySifter_MPAP4.MotorColor = iValue; sStatus = mySifter_MPAP4.Status_Sifter; sName = mySifter_MPAP4.Name; mySifter_MPAP4.Description_Sifter = moi.TagName + " " + moi.TagDescription; mySifter_MPAP4.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySifter_MPAP4.Fault_Sifter; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Sifter_MPAR case "Sifter_MPAR": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySifter_MPAR = (Sifter_MPAR)p1.FindName(sControlName); if (mySifter_MPAR == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { mySifter_MPAR.MotorColor = iValue; sStatus = mySifter_MPAR.Status_Sifter; sName = mySifter_MPAR.Name; mySifter_MPAR.Description_Sifter = moi.TagName + " " + moi.TagDescription; mySifter_MPAR.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySifter_MPAR.Fault_Sifter; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Sifter_MTZA1 case "Sifter_MTZA1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySifter_MTZA1 = (Sifter_MTZA1)p1.FindName(sControlName); if (mySifter_MTZA1 == null) bControlDoesntExist = true; if (sPropertyName == "ColorAspirationMotor") { mySifter_MTZA1.ColorAspirationMotor = iValue; sStatus = mySifter_MTZA1.Status_AspirationMotor; sName = mySifter_MTZA1.Name; mySifter_MTZA1.Description_AspirationMotor = moi.TagName + " " + moi.TagDescription; mySifter_MTZA1.ObjectNumber1 = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySifter_MTZA1.Fault_AspirationMotor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else if (sPropertyName == "ColorFeedMotor") { mySifter_MTZA1.ColorFeedMotor = iValue; sStatus = mySifter_MTZA1.Status_FeedMotor; sName = mySifter_MTZA1.Name; mySifter_MTZA1.Description_FeedMotor = moi.TagName + " " + moi.TagDescription; mySifter_MTZA1.ObjectNumber2 = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySifter_MTZA1.Fault_FeedMotor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Silo_Door1 case "Silo_Door1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySilo1_Door = (Silo_Door1)p1.FindName(sControlName); if (mySilo1_Door == null) bControlDoesntExist = true; if (sPropertyName == "DoorColor") { mySilo1_Door.DoorColor = iValue; sStatus = mySilo1_Door.Status_Door; sName = mySilo1_Door.Name; mySilo1_Door.Description_Door = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySilo1_Door.Fault_Door; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region SlideGate case "SlideGate": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySlideGate = (SlideGate)p1.FindName(sControlName); if (mySlideGate == null) bControlDoesntExist = true; if (sPropertyName == "SlideColor") { mySlideGate.SlideColor = iValue; sStatus = mySlideGate.Status_Slide; sName = mySlideGate.Name; mySlideGate.Description_Slide = moi.TagName + " " + moi.TagDescription; mySlideGate.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySlideGate.Fault_Slide; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Solenoid_RinsingAir case "Solenoid_RinsingAir": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySolenoid_RinsingAir = (Solenoid_RinsingAir)p1.FindName(sControlName); if (mySolenoid_RinsingAir == null) bControlDoesntExist = true; if (sPropertyName == "ValveColor") { mySolenoid_RinsingAir.ValveColor = iValue; sStatus = mySolenoid_RinsingAir.Status_Valve; sName = mySolenoid_RinsingAir.Name; mySolenoid_RinsingAir.Description_Valve = moi.TagName + " " + moi.TagDescription; mySolenoid_RinsingAir.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySolenoid_RinsingAir.Fault_Valve; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Sortex1 case "Sortex1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySortex1 = (Sortex1)p1.FindName(sControlName); if (mySortex1 == null) bControlDoesntExist = true; if (sPropertyName == "SortexColor") { mySortex1.SortexColor = iValue; sStatus = mySortex1.Status_Sortex; sName = mySortex1.Name; mySortex1.Description_Sortex = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySortex1.Fault_Sortex; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region SpeedMonitor case "SpeedMonitor": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySpeedMonitor = (SpeedMonitor)p1.FindName(sControlName); if (mySpeedMonitor == null) bControlDoesntExist = true; if (sPropertyName == "MonitorColor") { mySpeedMonitor.MonitorColor = iValue; sStatus = mySpeedMonitor.Status_SpeedMonitor; sName = mySpeedMonitor.Name; mySpeedMonitor.Description_SpeedMonitor = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySpeedMonitor.Fault_SpeedMonitor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Switch_Pressure case "Switch_Pressure": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var mySwitch_Pressure = (Switch_Pressure)p1.FindName(sControlName); if (mySwitch_Pressure == null) bControlDoesntExist = true; if (sPropertyName == "PressureSwitchColor") { mySwitch_Pressure.PressureSwitchColor = iValue; sStatus = mySwitch_Pressure.Status_PressureSwitch; sName = mySwitch_Pressure.Name; mySwitch_Pressure.Description_PressureSwitch = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = mySwitch_Pressure.Fault_PressureSwitch; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region TemperatureSensor_1 case "TemperatureSensor_1": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myTemperatureSensor = (TemperatureSensor_1)p1.FindName(sControlName); if (myTemperatureSensor == null) bControlDoesntExist = true; if (sPropertyName == "SensorColor") { myTemperatureSensor.SensorColor = iValue; sStatus = myTemperatureSensor.Status_Switch; sName = myTemperatureSensor.Name; myTemperatureSensor.Description_Switch = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myTemperatureSensor.Fault_Switch; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region ThrowSifter_DFTA_13 case "ThrowSifter_DFTA_13": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myThrowSifter_DFTA_13 = (ThrowSifter_DFTA_13)p1.FindName(sControlName); if (myThrowSifter_DFTA_13 == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myThrowSifter_DFTA_13.MotorColor = iValue; sStatus = myThrowSifter_DFTA_13.Status_ThrowSifter; sName = myThrowSifter_DFTA_13.Name; myThrowSifter_DFTA_13.Description_ThrowSifter = moi.TagName + " " + moi.TagDescription; myThrowSifter_DFTA_13.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myThrowSifter_DFTA_13.Fault_ThrowSifter; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Valve_WaterShutoff case "Valve_WaterShutoff": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myValve_WaterShutoff = (Valve_WaterShutoff)p1.FindName(sControlName); if (myValve_WaterShutoff == null) bControlDoesntExist = true; if (sPropertyName == "VavleColor") { myValve_WaterShutoff.VavleColor = iValue; sStatus = myValve_WaterShutoff.Status_Vavle; sName = myValve_WaterShutoff.Name; myValve_WaterShutoff.Description_Vavle = moi.TagName + " " + moi.TagDescription; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myValve_WaterShutoff.Fault_Vavle; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region VibratoryFeeder_MZVE case "VibratoryFeeder_MZVE": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myVibratoryFeeder_MZVE = (VibratoryFeeder_MZVE)p1.FindName(sControlName); if (myVibratoryFeeder_MZVE == null) bControlDoesntExist = true; if (sPropertyName == "FeederColor") { myVibratoryFeeder_MZVE.FeederColor = iValue; sStatus = myVibratoryFeeder_MZVE.Status_Feeder; sName = myVibratoryFeeder_MZVE.Name; myVibratoryFeeder_MZVE.Description_Feeder = moi.TagName + " " + moi.TagDescription; myVibratoryFeeder_MZVE.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myVibratoryFeeder_MZVE.Fault_Feeder; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region VibroSieve_MKZH case "VibroSieve_MKZH": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myVibroSieve_MKZH = (VibroSieve_MKZH)p1.FindName(sControlName); if (myVibroSieve_MKZH == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myVibroSieve_MKZH.MotorColor = iValue; sStatus = myVibroSieve_MKZH.Status_Motor; sName = myVibroSieve_MKZH.Name; myVibroSieve_MKZH.Description_Motor = moi.TagName + " " + moi.TagDescription; myVibroSieve_MKZH.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myVibroSieve_MKZH.Fault_Motor; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region VibroSifter_MKZH case "VibroSifter_MKZH": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myVibroSifter_MKZH = (VibroSifter_MKZH)p1.FindName(sControlName); if (myVibroSifter_MKZH == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myVibroSifter_MKZH.MotorColor = iValue; sStatus = myVibroSifter_MKZH.Status_VibroSifter; sName = myVibroSifter_MKZH.Name; myVibroSifter_MKZH.Description_VibroSifter = moi.TagName + " " + moi.TagDescription; myVibroSifter_MKZH.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myVibroSifter_MKZH.Fault_VibroSifter; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion #region Wheat_Steriliser_MJZD case "Wheat_Steriliser_MJZD": p1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { try { var myWheat_Steriliser_MJZD = (Wheat_Steriliser_MJZD)p1.FindName(sControlName); if (myWheat_Steriliser_MJZD == null) bControlDoesntExist = true; if (sPropertyName == "MotorColor") { myWheat_Steriliser_MJZD.MotorColor = iValue; sStatus = myWheat_Steriliser_MJZD.StatusWheat_Steriliser; sName = myWheat_Steriliser_MJZD.Name; myWheat_Steriliser_MJZD.DescriptionWheat_Steriliser = moi.TagName + " " + moi.TagDescription; myWheat_Steriliser_MJZD.ObjectNumber = moi.ObjectNo; string sFaultString = moi.TagDescription + " (" + sStatus + ")"; bool bIsInFault = myWheat_Steriliser_MJZD.FaultWheat_Steriliser; RegisterEvent(bIsInFault, sFaultString, moi.TagName, iValue, bLogThisChange); } else bConfigError = true; } catch (NullReferenceException) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Link Error", ErrorString = "Control " + sControlName + " does not exist on display page. Links exist in database. [" + Tagname + "]" }); btnErrors.Background = Brushes.Red; } catch (Exception ae) { AddError(new Error { ErrorTag = sControlName, ErrorSource = "Control Type", ErrorString = ae.Message }); btnErrors.Background = Brushes.Red; } })); break; #endregion case "...": break; default: AddError(new Error { ErrorTag = Tagname, ErrorSource = "STATE", ErrorString = "UserControl <" + sControlType + "> was not found" }); break; } // //Update the Element status event if the selected control has changed state // if (sActiveControl == sName) sElementState = sStatus; if (bControlDoesntExist) AddError(new Error { ErrorTag = Tagname, ErrorSource = "CONTROL", ErrorString = sControlName + "<" + sControlType + "> does not exist. There are taglinks configured." }); else if (bConfigError) AddError(new Error { ErrorTag = Tagname, ErrorSource = "STATE", ErrorString = "UserControl <" + sControlType + "> does not contain property : [" + sPropertyName + "]" }); }