public void SetLedIndicator(string Indicator, int Val, string Log) { if (ReceivedCmd.InvokeRequired) { SetLedIndicatorCallback d = new SetLedIndicatorCallback(SetLedIndicator); ReceivedCmd.Invoke(d, new object[] { Indicator, Val, Log }); // invoking itself } else { int a = 0; string text = null; if (Log != "" && Indicator != "Track_No") { text = DateTime.Now + Log + Convert.ToBoolean(Val) + Environment.NewLine; ReceivedCmd.AppendText(text); StoreText(text); } else if (Log != "" && Indicator == "Track_No") { a = Convert.ToInt16(Val) >> 4; text = DateTime.Now + Log + Convert.ToString(a) + Environment.NewLine; ReceivedCmd.AppendText(text); StoreText(text); } switch (Indicator) { case "LLed_Heart": if (Val >= 1) { LLed_Heart.BackColor = Color.Lime; LLed_Heart.ForeColor = Color.Black; LLed_Heart.Text = "Aligned"; } if (Val == 0) { LLed_Heart.BackColor = Color.Red; LLed_Heart.ForeColor = Color.Yellow; LLed_Heart.Text = "Unaligned"; } break; case "2": break; case "LLed_F11": if (Val >= 1) { LLed_F11.BackColor = Color.Yellow; } if (Val == 0) { if (Initialized == false) { LLed_F11.BackColor = Color.Cyan; } else { LLed_F11.BackColor = Color.Transparent; // change color status else sensor keeps being red. Run before UpdateTrackIndicatorColor() CheckWhichTrackInline(); } } break; case "LLed_EOS10": if (Val >= 1) { LLed_EOS10.BackColor = Color.Red; LLed_EOS10.ForeColor = Color.Yellow; } if (Val == 0) { LLed_EOS10.BackColor = Color.Transparent; LLed_EOS10.ForeColor = Color.Black; } break; case "LLed_EOS11": if (Val >= 1) { LLed_EOS11.BackColor = Color.Red; LLed_EOS11.ForeColor = Color.Yellow; } if (Val == 0) { LLed_EOS11.BackColor = Color.Transparent; LLed_EOS11.ForeColor = Color.Black; } break; case "6": break; case "LLed_F13": if (Val >= 1) { LLed_F13.BackColor = Color.Red; LLed_F13.ForeColor = Color.Yellow; } if (Val == 0) { if (Initialized == false) { LLed_F13.ForeColor = Color.Black; LLed_F13.BackColor = Color.Cyan; } else { LLed_F13.ForeColor = Color.Black; LLed_F13.BackColor = Color.Transparent; // change color status else sensor keeps being red. Run before UpdateTrackIndicatorColor() CheckWhichTrackInline(); } } break; case "LLed_F12": if (Val >= 1) { LLed_F12.BackColor = Color.Red; LLed_F12.ForeColor = Color.Yellow; } if (Val == 0) { if (Initialized == false) { LLed_F12.BackColor = Color.Cyan; LLed_F12.ForeColor = Color.Black; } else { LLed_F12.ForeColor = Color.Black; LLed_F12.BackColor = Color.Transparent; // change color status else sensor keeps being red. Run before UpdateTrackIndicatorColor() CheckWhichTrackInline(); } } break; case "LLed_Block5B": if (Val >= 1) { LLed_Block5B.BackColor = Color.Lime; } if (Val == 0) { LLed_Block5B.BackColor = Color.Transparent; } break; case "LLed_Block8A": if (Val >= 1) { LLed_Block8A.BackColor = Color.Lime; } if (Val == 0) { LLed_Block8A.BackColor = Color.Transparent; } break; case "LLed_TrackPower": if (Val >= 1) { LLed_TrackPower.BackColor = Color.Lime; LLed_TrackPower.Text = "Coupled"; LLed_TrackPower.ForeColor = Color.Black; } if (Val == 0) { LLed_TrackPower.BackColor = Color.Red; LLed_TrackPower.Text = "Uncoupled"; LLed_TrackPower.ForeColor = Color.Yellow; } break; case "LLed_Block5BIn": if (Val >= 1) { LLed_Block5BIn.BackColor = Color.Red; Btn_Bezet5BOn_TOP.Text = "Off"; Btn_Bezet5BOn_TOP_Click_Toggle = false; } if (Val == 0) { LLed_Block5BIn.BackColor = Color.Transparent; Btn_Bezet5BOn_TOP.Text = "On"; Btn_Bezet5BOn_TOP_Click_Toggle = true; } break; case "LLed_Block6In": if (Val >= 1) { LLed_Block6In.BackColor = Color.Red; Btn_Bezet6On_TOP.Text = "Off"; Btn_Bezet6On_TOP_Click_Toggle = false; } if (Val == 0) { LLed_Block6In.BackColor = Color.Transparent; Btn_Bezet6On_TOP.Text = "On"; Btn_Bezet6On_TOP_Click_Toggle = true; } break; case "LLed_Block7In": if (Val >= 1) { LLed_Block7In.BackColor = Color.Red; Btn_Bezet7On_TOP.Text = "Off"; Btn_Bezet7On_TOP_Click_Toggle = false; } if (Val == 0) { if (LLed_Block7.BackColor == Color.Lime) { LLed_Block7In.BackColor = Color.Lime; } else { LLed_Block7In.BackColor = Color.Transparent; } Btn_Bezet7On_TOP.Text = "On"; Btn_Bezet7On_TOP_Click_Toggle = true; } break; case "LLed_Resistor": if (Val >= 1) { LLed_Resistor.BackColor = Color.Lime; } if (Val == 0) { LLed_Resistor.BackColor = Color.Transparent; } break; case "LLed_Track1": if (Val >= 1 && TrackStatusLight[1] == true) { LLed_Track1.BackColor = Color.Lime; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1) { LLed_Track1.BackColor = Color.Green; CheckWhichTrackInline(); // Sensor background color update } if (Val == 0 && Initialized == true) { LLed_Track1.BackColor = Color.Transparent; CheckWhichTrackInline(); // Sensor background color update } else if (Initialized == false) { LLed_Track1.BackColor = Color.Cyan; // After processor update from true to false set to cyan if initialized is false. LLed_Track1.Text = " Not Initialized"; CheckWhichTrackInline(); // Sensor background color update } break; case "LLed_Track2": if (Val >= 1 && TrackStatusLight[2] == true) { LLed_Track2.BackColor = Color.Lime; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1) { LLed_Track2.BackColor = Color.Green; CheckWhichTrackInline(); // Sensor background color update } if (Val == 0 && Initialized == true) { LLed_Track2.BackColor = Color.Transparent; CheckWhichTrackInline(); // Sensor background color update } else if (Initialized == false) { LLed_Track2.BackColor = Color.Cyan; LLed_Track2.Text = " Not Initialized"; CheckWhichTrackInline(); // Sensor background color update } break; case "LLed_Track3": if (Val >= 1 && TrackStatusLight[3] == true) { LLed_Track3.BackColor = Color.Lime; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1) { LLed_Track3.BackColor = Color.Green; CheckWhichTrackInline(); // Sensor background color update } if (Val == 0 && Initialized == true) { LLed_Track3.BackColor = Color.Transparent; CheckWhichTrackInline(); // Sensor background color update } else if (Initialized == false) { LLed_Track3.BackColor = Color.Cyan; LLed_Track3.Text = " Not Initialized"; CheckWhichTrackInline(); // Sensor background color update } break; case "LLed_Track4": if (Val >= 1 && TrackStatusLight[4] == true) { LLed_Track4.BackColor = Color.Lime; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1) { LLed_Track4.BackColor = Color.Green; CheckWhichTrackInline(); // Sensor background color update } if (Val == 0 && Initialized == true) { LLed_Track4.BackColor = Color.Transparent; CheckWhichTrackInline(); // Sensor background color update } else if (Initialized == false) { LLed_Track4.BackColor = Color.Cyan; LLed_Track4.Text = " Not Initialized"; CheckWhichTrackInline(); // Sensor background color update } break; case "LLed_Track5": if (Val >= 1 && TrackStatusLight[5] == true) { LLed_Track5.BackColor = Color.Lime; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1) { LLed_Track5.BackColor = Color.Green; CheckWhichTrackInline(); // Sensor background color update } if (Val == 0 && Initialized == true) { LLed_Track5.BackColor = Color.Transparent; CheckWhichTrackInline(); // Sensor background color update } else if (Initialized == false) { LLed_Track5.BackColor = Color.Cyan; LLed_Track5.Text = " Not Initialized"; CheckWhichTrackInline(); // Sensor background color update } break; case "LLed_Track6": if (Val >= 1 && TrackStatusLight[6] == true) { LLed_Track6.BackColor = Color.Lime; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1) { LLed_Track6.BackColor = Color.Green; CheckWhichTrackInline(); // Sensor background color update } if (Val == 0 && Initialized == true) { LLed_Track6.BackColor = Color.Transparent; CheckWhichTrackInline(); // Sensor background color update } else if (Initialized == false) { LLed_Track6.BackColor = Color.Cyan; LLed_Track6.Text = " Not Initialized"; CheckWhichTrackInline(); // Sensor background color update } break; case "LLed_Track7": if (Val >= 1 && TrackStatusLight[7] == true) { LLed_Track7.BackColor = Color.Lime; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1) { LLed_Track7.BackColor = Color.Green; CheckWhichTrackInline(); // Sensor background color update } if (Val == 0 && Initialized == true) { LLed_Track7.BackColor = Color.Transparent; CheckWhichTrackInline(); // Sensor background color update } else if (Initialized == false) { LLed_Track7.BackColor = Color.Cyan; LLed_Track7.Text = " Not Initialized"; CheckWhichTrackInline(); // Sensor background color update } break; case "LLed_Track8": if (Val >= 1 && TrackStatusLight[8] == true) { LLed_Track8.BackColor = Color.Lime; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1) { LLed_Track8.BackColor = Color.Green; CheckWhichTrackInline(); // Sensor background color update } if (Val == 0 && Initialized == true) { LLed_Track8.BackColor = Color.Transparent; CheckWhichTrackInline(); // Sensor background color update } else if (Initialized == false) { LLed_Track8.BackColor = Color.Cyan; LLed_Track8.Text = " Not Initialized"; CheckWhichTrackInline(); // Sensor background color update } break; case "LLed_Track9": if (Val >= 1 && TrackStatusLight[9] == true) { LLed_Track9.BackColor = Color.Lime; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1) { LLed_Track9.BackColor = Color.Green; CheckWhichTrackInline(); // Sensor background color update } if (Val == 0 && Initialized == true) { LLed_Track9.BackColor = Color.Transparent; CheckWhichTrackInline(); // Sensor background color update } else if (Initialized == false) { LLed_Track9.BackColor = Color.Cyan; LLed_Track9.Text = " Not Initialized"; CheckWhichTrackInline(); // Sensor background color update } break; case "LLed_Track10": if (Val >= 1 && TrackStatusLight[10] == true) { LLed_Track10.BackColor = Color.Lime; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1) { LLed_Track10.BackColor = Color.Green; CheckWhichTrackInline(); // Sensor background color update } if (Val == 0 && Initialized == true) { LLed_Track10.BackColor = Color.Transparent; CheckWhichTrackInline(); // Sensor background color update } else if (Initialized == false) { LLed_Track10.BackColor = Color.Cyan; LLed_Track10.Text = " Not Initialized"; CheckWhichTrackInline(); // Sensor background color update } break; case "LLed_Track11": if (Val >= 1 && TrackStatusLight[11] == true) { LLed_Track11.BackColor = Color.Lime; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1) { LLed_Track11.BackColor = Color.Green; CheckWhichTrackInline(); // Sensor background color update } if (Val == 0 && Initialized == true) { LLed_Track11.BackColor = Color.Transparent; CheckWhichTrackInline(); // Sensor background color update } else if (Initialized == false) { LLed_Track11.BackColor = Color.Cyan; LLed_Track11.Text = " Not Initialized"; CheckWhichTrackInline(); // Sensor background color update } break; case "LLed_Block6": if (Val >= 1) { LLed_Block6.BackColor = Color.Lime; } if (Val == 0) { LLed_Block6.BackColor = Color.Transparent; } break; case "LLed_Block7": if (Val >= 1) { LLed_Block7.BackColor = Color.Lime; } if (Val == 0) { LLed_Block7.BackColor = Color.Transparent; } break; case "LLed_15VTrackPower": if (Val >= 1) { LLed_15VTrackPower.BackColor = Color.Lime; LLed_15VTrackPower.ForeColor = Color.Black; LLed_15VTrackPower.Text = "Drive Power On"; } if (Val == 0) { LLed_15VTrackPower.BackColor = Color.Red; LLed_15VTrackPower.ForeColor = Color.Yellow; LLed_15VTrackPower.Text = "Drive Power Off"; } break; case "LLed_F10": if (Val >= 1) { LLed_F10.BackColor = Color.Yellow; LLed_F10_2_TOP.BackColor = Color.Yellow; } if (Val == 0) { LLed_F10.BackColor = Color.Transparent; LLed_F10_2_TOP.BackColor = Color.Transparent; } break; case "LLed_M10": if (Val >= 1) { LLed_M10.BackColor = Color.Lime; } if (Val == 0) { LLed_M10.BackColor = Color.Transparent; } break; case "Track_No": Track_No.Text = Convert.ToString(a); for (int i = 0; i < 12; i++) { TrackStatusLight[i] = false; } TrackStatusLight[a] = true; ShiftIndicatorPos(a); if (Initialized == true) { UpdateTrackIndicatorColor(); // After/during shift update color of tracks accordingly } break; default: break; } } }
/*#--------------------------------------------------------------------------#*/ /* Description: SetLedIndicator * * * * * Input(s) : * * Output(s) : * * Returns : * * Pre.Cond. : * * Post.Cond. : * * Notes : */ /*#--------------------------------------------------------------------------#*/ public void SetLedIndicator(string Indicator, int Val, string Log) { if (ReceivedCmd.InvokeRequired) { SetLedIndicatorCallback d = new SetLedIndicatorCallback(SetLedIndicator); ReceivedCmd.Invoke(d, new object[] { Indicator, Val, Log }); // invoking itself } else { int a = 0; a = Convert.ToInt16(Val) >> 4; switch (Indicator) { case "LLed_Heart": if (Val >= 1) { LLed_Heart.BackColor = Color.Lime; LLed_Heart.ForeColor = Color.Black; LLed_Heart.Text = "Aligned"; } if (Val == 0) { LLed_Heart.BackColor = Color.Red; LLed_Heart.ForeColor = Color.Yellow; LLed_Heart.Text = "Unaligned"; } break; case "2": break; case "LLed_F11": if (Val >= 1) { LLed_F11.BackColor = Color.Yellow; MoveTrainImage("LLed_F11", true); } if (Val == 0) { if (Initialized == false) { LLed_F11.BackColor = m_FYAppVar.TrackNotInitializedColor;; } else { LLed_F11.BackColor = Color.Transparent; // change color status else sensor keeps being red. Run before UpdateTrackIndicatorColor() CheckWhichTrackInline(); } MoveTrainImage("LLed_F11", false); } break; case "LLed_EOS10": if (Val >= 1) { LLed_EOS10.BackColor = Color.Red; LLed_EOS10.ForeColor = Color.Yellow; } if (Val == 0) { LLed_EOS10.BackColor = Color.Transparent; LLed_EOS10.ForeColor = Color.Black; } break; case "LLed_EOS11": if (Val >= 1) { LLed_EOS11.BackColor = Color.Red; LLed_EOS11.ForeColor = Color.Yellow; } if (Val == 0) { LLed_EOS11.BackColor = Color.Transparent; LLed_EOS11.ForeColor = Color.Black; } break; case "6": break; case "LLed_F13": if (Val >= 1) { LLed_F13.BackColor = Color.Red; LLed_F13.ForeColor = Color.Yellow; MoveTrainImage("LLed_F13", true); } if (Val == 0) { if (Initialized == false) { LLed_F13.ForeColor = Color.Black; LLed_F13.BackColor = m_FYAppVar.TrackNotInitializedColor;; } else { LLed_F13.ForeColor = Color.Black; LLed_F13.BackColor = Color.Transparent; // change color status else sensor keeps being red. Run before UpdateTrackIndicatorColor() CheckWhichTrackInline(); } MoveTrainImage("LLed_F13", false); } break; case "LLed_F12": if (Val >= 1) { LLed_F12.BackColor = Color.Red; LLed_F12.ForeColor = Color.Yellow; MoveTrainImage("LLed_F12", true); } if (Val == 0) { if (Initialized == false) { LLed_F12.BackColor = m_FYAppVar.TrackNotInitializedColor;; LLed_F12.ForeColor = Color.Black; } else { LLed_F12.ForeColor = Color.Black; LLed_F12.BackColor = Color.Transparent; // change color status else sensor keeps being red. Run before UpdateTrackIndicatorColor() CheckWhichTrackInline(); } MoveTrainImage("LLed_F12", false); } break; case "LLed_Block5B": if (Val >= 1) { LLed_Block5B.BackColor = m_FYAppVar.TrackOccupiedColor;// Color.Lime;//GetBackColor when active MoveTrainImage("LLed_Block5B", true); PB_Bk5_Train.Show(); } if (Val == 0) { LLed_Block5B.BackColor = Color.Transparent;// Color.Transparent;//GetBackcolor when not active PB_Bk5_Train.Hide(); MoveTrainImage("LLed_Block5B", false); } PB_Bk5_Train.BackColor = LLed_Block5B.BackColor; break; case "LLed_Block8A": if (Val >= 1) { LLed_Block8A.BackColor = m_FYAppVar.TrackOccupiedColor;//Color.Lime; MoveTrainImage("LLed_Block8A", true); PB_Bk8A_Train.Show(); } if (Val == 0) { LLed_Block8A.BackColor = Color.Transparent;// Color.Transparent; //PB_Bk8A_Train.Hide(); PB_Bk8A_Train.Image = null; // clear image for next train drive_out MoveTrainImage("LLed_Block8A", false); } PB_Bk8A_Train.BackColor = LLed_Block8A.BackColor; break; case "LLed_TrackPower": if (Val >= 1) { LLed_TrackPower.BackColor = m_FYAppVar.TrackOccupiedColor;//Color.Lime; LLed_TrackPower.Text = "Coupled"; LLed_TrackPower.ForeColor = Color.Black; } if (Val == 0) { LLed_TrackPower.BackColor = Color.Red; LLed_TrackPower.Text = "Uncoupled"; LLed_TrackPower.ForeColor = Color.Yellow; } break; case "LLed_Block5BIn": if (Val >= 1) { PB_Block5BIn.Image = SeinRed; LLed_Block5BIn.BackColor = Color.Red; Btn_Bezet5BOn_TOP.Text = "Off"; Btn_Bezet5BOn_TOP_Click_Toggle = false; } if (Val == 0) { PB_Block5BIn.Image = SeinGreen; LLed_Block5BIn.BackColor = m_FYAppVar.TrackOccupiedColor; //Color.Lime; Btn_Bezet5BOn_TOP.Text = "On"; Btn_Bezet5BOn_TOP_Click_Toggle = true; MoveTrainImage("LLed_Block5BIn", true); } break; case "LLed_Block6In": if (Val >= 1) { PB_Block6In.Image = SeinRed; LLed_Block6In.BackColor = Color.Red; Btn_Bezet6On_TOP.Text = "Off"; Btn_Bezet6On_TOP_Click_Toggle = false; } if (Val == 0) { PB_Block6In.Image = SeinGreen; LLed_Block6In.BackColor = m_FYAppVar.TrackOccupiedColor; //Color.Lime; Btn_Bezet6On_TOP.Text = "On"; Btn_Bezet6On_TOP_Click_Toggle = true; } break; case "LLed_Block7In": if (Val >= 1) { PB_Block7In.Image = SeinRed; LLed_Block7In.BackColor = Color.Red; Btn_Bezet7On_TOP.Text = "Off"; Btn_Bezet7On_TOP_Click_Toggle = false; } if (Val == 0) { PB_Block7In.Image = SeinGreen; LLed_Block7In.BackColor = m_FYAppVar.TrackOccupiedColor; //Color.Lime; Btn_Bezet7On_TOP.Text = "On"; Btn_Bezet7On_TOP_Click_Toggle = true; MoveTrainImage("LLed_Block7In", true); } break; case "LLed_Resistor": if (Val >= 1) { LLed_Resistor.BackColor = m_FYAppVar.TrackOccupiedColor; //Color.Lime; } if (Val == 0) { LLed_Resistor.BackColor = Color.Transparent; } break; case "LLed_Track1": if (Val >= 1 && TrackStatusLight[1] == true) // If train present and Track is active and track is enabled { LLed_Track1.BackColor = m_FYAppVar.TrackOccupiedColor; // Set TrackOccupiedColor //PB_Tr1_Train.Show(); // Train present? PB_Tr1_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1 && TrackStatusLight[1] == false) // If train present and Track is not active and track is enabled { LLed_Track1.BackColor = m_FYAppVar.TrackNotActiveColor; // Set TrackNotActiveColor (but is occupied) //PB_Tr1_Train.Show(); // Train present? PB_Tr1_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val == 0 && Initialized == true) // If train not present and FY is initialized and Track is enabled { LLed_Track1.BackColor = Color.Transparent; // Set Color.Transparent //PB_Tr1_Train.Hide(); // Train present? PB_Tr1_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } if (Initialized == false) // If FY is not initialized { LLed_Track1.BackColor = m_FYAppVar.TrackNotInitializedColor; // Set TrackNotInitializedColor LLed_Track1.Text = " Not Initialized"; // Set Track text //PB_Tr1_Train.Hide(); // Train present? PB_Tr1_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } PB_Tr1_Active.BackColor = LLed_Track1.BackColor; PB_Tr1_Inline.BackColor = LLed_Track1.BackColor; PB_Tr1_Train.BackColor = LLed_Track1.BackColor; break; case "LLed_Track2": if (Val >= 1 && TrackStatusLight[2] == true) // If train present and Track is active and track is enabled { LLed_Track2.BackColor = m_FYAppVar.TrackOccupiedColor; // Set TrackOccupiedColor //PB_Tr2_Train.Show(); // Train present? PB_Tr2_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1 && TrackStatusLight[2] == false) // If train present and Track is not active and track is enabled { LLed_Track2.BackColor = m_FYAppVar.TrackNotActiveColor; // Set TrackNotActiveColor (but is occupied) //PB_Tr2_Train.Show(); // Train present? PB_Tr2_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val == 0 && Initialized == true) // If train not present and FY is initialized and Track is enabled { LLed_Track2.BackColor = Color.Transparent; // Set Color.Transparent //PB_Tr2_Train.Hide(); // Train present? PB_Tr2_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } if (Initialized == false) // If FY is not initialized { LLed_Track2.BackColor = m_FYAppVar.TrackNotInitializedColor; // Set TrackNotInitializedColor LLed_Track2.Text = " Not Initialized"; // Set Track text //PB_Tr2_Train.Hide(); // Train present? PB_Tr2_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } PB_Tr2_Active.BackColor = LLed_Track2.BackColor; PB_Tr2_Inline.BackColor = LLed_Track2.BackColor; PB_Tr2_Train.BackColor = LLed_Track2.BackColor; break; case "LLed_Track3": if (Val >= 1 && TrackStatusLight[3] == true) // If train present and Track is active and track is enabled { LLed_Track3.BackColor = m_FYAppVar.TrackOccupiedColor; // Set TrackOccupiedColor //PB_Tr3_Train.Show(); // Train present? PB_Tr3_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1 && TrackStatusLight[3] == false) // If train present and Track is not active and track is enabled { LLed_Track3.BackColor = m_FYAppVar.TrackNotActiveColor; // Set TrackNotActiveColor (but is occupied) //PB_Tr3_Train.Show(); // Train present? PB_Tr3_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val == 0 && Initialized == true) // If train not present and FY is initialized and Track is enabled { LLed_Track3.BackColor = Color.Transparent; // Set Color.Transparent //PB_Tr3_Train.Hide(); // Train present? PB_Tr3_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } if (Initialized == false) // If FY is not initialized { LLed_Track3.BackColor = m_FYAppVar.TrackNotInitializedColor; // Set TrackNotInitializedColor LLed_Track3.Text = " Not Initialized"; // Set Track text //PB_Tr3_Train.Hide(); // Train present? PB_Tr3_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } PB_Tr3_Active.BackColor = LLed_Track3.BackColor; PB_Tr3_Inline.BackColor = LLed_Track3.BackColor; PB_Tr3_Train.BackColor = LLed_Track3.BackColor; break; case "LLed_Track4": if (Val >= 1 && TrackStatusLight[4] == true) // If train present and Track is active and track is enabled { LLed_Track4.BackColor = m_FYAppVar.TrackOccupiedColor; // Set TrackOccupiedColor //PB_Tr4_Train.Show(); // Train present? PB_Tr4_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1 && TrackStatusLight[4] == false) // If train present and Track is not active and track is enabled { LLed_Track4.BackColor = m_FYAppVar.TrackNotActiveColor; // Set TrackNotActiveColor (but is occupied) //PB_Tr4_Train.Show(); // Train present? PB_Tr4_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val == 0 && Initialized == true) // If train not present and FY is initialized and Track is enabled { LLed_Track4.BackColor = Color.Transparent; // Set Color.Transparent //PB_Tr4_Train.Hide(); // Train present? PB_Tr4_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } if (Initialized == false) // If FY is not initialized { LLed_Track4.BackColor = m_FYAppVar.TrackNotInitializedColor; // Set TrackNotInitializedColor LLed_Track4.Text = " Not Initialized"; // Set Track text //PB_Tr4_Train.Hide(); // Train present? PB_Tr4_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } PB_Tr4_Active.BackColor = LLed_Track4.BackColor; PB_Tr4_Inline.BackColor = LLed_Track4.BackColor; PB_Tr4_Train.BackColor = LLed_Track4.BackColor; break; case "LLed_Track5": if (Val >= 1 && TrackStatusLight[5] == true) // If train present and Track is active and track is enabled { LLed_Track5.BackColor = m_FYAppVar.TrackOccupiedColor; // Set TrackOccupiedColor //PB_Tr5_Train.Show(); // Train present? PB_Tr5_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1 && TrackStatusLight[5] == false) // If train present and Track is not active and track is enabled { LLed_Track5.BackColor = m_FYAppVar.TrackNotActiveColor; // Set TrackNotActiveColor (but is occupied) //PB_Tr5_Train.Show(); // Train present? PB_Tr5_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val == 0 && Initialized == true) // If train not present and FY is initialized and Track is enabled { LLed_Track5.BackColor = Color.Transparent; // Set Color.Transparent //PB_Tr5_Train.Hide(); // Train present? PB_Tr5_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } if (Initialized == false) // If FY is not initialized { LLed_Track5.BackColor = m_FYAppVar.TrackNotInitializedColor; // Set TrackNotInitializedColor LLed_Track5.Text = " Not Initialized"; // Set Track text //PB_Tr5_Train.Hide(); // Train present? PB_Tr5_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } PB_Tr5_Active.BackColor = LLed_Track5.BackColor; PB_Tr5_Inline.BackColor = LLed_Track5.BackColor; PB_Tr5_Train.BackColor = LLed_Track5.BackColor; break; case "LLed_Track6": if (Val >= 1 && TrackStatusLight[6] == true) // If train present and Track is active and track is enabled { LLed_Track6.BackColor = m_FYAppVar.TrackOccupiedColor; // Set TrackOccupiedColor //PB_Tr6_Train.Show(); // Train present? PB_Tr6_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1 && TrackStatusLight[6] == false) // If train present and Track is not active and track is enabled { LLed_Track6.BackColor = m_FYAppVar.TrackNotActiveColor; // Set TrackNotActiveColor (but is occupied) //PB_Tr6_Train.Show(); // Train present? PB_Tr6_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val == 0 && Initialized == true) // If train not present and FY is initialized and Track is enabled { LLed_Track6.BackColor = Color.Transparent; // Set Color.Transparent //PB_Tr6_Train.Hide(); // Train present? PB_Tr6_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } if (Initialized == false) // If FY is not initialized { LLed_Track6.BackColor = m_FYAppVar.TrackNotInitializedColor; // Set TrackNotInitializedColor LLed_Track6.Text = " Not Initialized"; // Set Track text //PB_Tr6_Train.Hide(); // Train present? PB_Tr6_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } PB_Tr6_Active.BackColor = LLed_Track6.BackColor; PB_Tr6_Inline.BackColor = LLed_Track6.BackColor; PB_Tr6_Train.BackColor = LLed_Track6.BackColor; break; case "LLed_Track7": if (Val >= 1 && TrackStatusLight[7] == true) // If train present and Track is active and track is enabled { LLed_Track7.BackColor = m_FYAppVar.TrackOccupiedColor; // Set TrackOccupiedColor //PB_Tr7_Train.Show(); // Train present? PB_Tr7_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1 && TrackStatusLight[7] == false) // If train present and Track is not active and track is enabled { LLed_Track7.BackColor = m_FYAppVar.TrackNotActiveColor; // Set TrackNotActiveColor (but is occupied) //PB_Tr7_Train.Show(); // Train present? PB_Tr7_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val == 0 && Initialized == true) // If train not present and FY is initialized and Track is enabled { LLed_Track7.BackColor = Color.Transparent; // Set Color.Transparent //PB_Tr7_Train.Hide(); // Train present? PB_Tr7_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } if (Initialized == false) // If FY is not initialized { LLed_Track7.BackColor = m_FYAppVar.TrackNotInitializedColor; // Set TrackNotInitializedColor LLed_Track7.Text = " Not Initialized"; // Set Track text //PB_Tr7_Train.Hide(); // Train present? PB_Tr7_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } PB_Tr7_Active.BackColor = LLed_Track7.BackColor; PB_Tr7_Inline.BackColor = LLed_Track7.BackColor; PB_Tr7_Train.BackColor = LLed_Track7.BackColor; break; case "LLed_Track8": if (Val >= 1 && TrackStatusLight[8] == true) // If train present and Track is active and track is enabled { LLed_Track8.BackColor = m_FYAppVar.TrackOccupiedColor; // Set TrackOccupiedColor //PB_Tr8_Train.Show(); // Train present? PB_Tr8_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1 && TrackStatusLight[8] == false) // If train present and Track is not active and track is enabled { LLed_Track8.BackColor = m_FYAppVar.TrackNotActiveColor; // Set TrackNotActiveColor (but is occupied) //PB_Tr8_Train.Show(); // Train present? PB_Tr8_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val == 0 && Initialized == true) // If train not present and FY is initialized and Track is enabled { LLed_Track8.BackColor = Color.Transparent; // Set Color.Transparent //PB_Tr8_Train.Hide(); // Train present? PB_Tr8_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } if (Initialized == false) // If FY is not initialized { LLed_Track8.BackColor = m_FYAppVar.TrackNotInitializedColor; // Set TrackNotInitializedColor LLed_Track8.Text = " Not Initialized"; // Set Track text //PB_Tr8_Train.Hide(); // Train present? PB_Tr8_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } PB_Tr8_Active.BackColor = LLed_Track8.BackColor; PB_Tr8_Inline.BackColor = LLed_Track8.BackColor; PB_Tr8_Train.BackColor = LLed_Track8.BackColor; break; case "LLed_Track9": if (Val >= 1 && TrackStatusLight[9] == true) // If train present and Track is active and track is enabled { LLed_Track9.BackColor = m_FYAppVar.TrackOccupiedColor; // Set TrackOccupiedColor //PB_Tr9_Train.Show(); // Train present? PB_Tr9_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1 && TrackStatusLight[9] == false) // If train present and Track is not active and track is enabled { LLed_Track9.BackColor = m_FYAppVar.TrackNotActiveColor; // Set TrackNotActiveColor (but is occupied) //PB_Tr9_Train.Show(); // Train present? PB_Tr9_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val == 0 && Initialized == true) // If train not present and FY is initialized and Track is enabled { LLed_Track9.BackColor = Color.Transparent; // Set Color.Transparent //PB_Tr9_Train.Hide(); // Train present? PB_Tr9_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } if (Initialized == false) // If FY is not initialized { LLed_Track9.BackColor = m_FYAppVar.TrackNotInitializedColor; // Set TrackNotInitializedColor LLed_Track9.Text = " Not Initialized"; // Set Track text //PB_Tr9_Train.Hide(); // Train present? PB_Tr9_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } PB_Tr9_Active.BackColor = LLed_Track9.BackColor; PB_Tr9_Inline.BackColor = LLed_Track9.BackColor; PB_Tr9_Train.BackColor = LLed_Track9.BackColor; break; case "LLed_Track10": if (Val >= 1 && TrackStatusLight[10] == true) // If train present and Track is active and track is enabled { LLed_Track10.BackColor = m_FYAppVar.TrackOccupiedColor; // Set TrackOccupiedColor //PB_Tr10_Train.Show(); // Train present? PB_Tr10_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1 && TrackStatusLight[10] == false) // If train present and Track is not active and track is enabled { LLed_Track10.BackColor = m_FYAppVar.TrackNotActiveColor; // Set TrackNotActiveColor (but is occupied) //PB_Tr10_Train.Show(); // Train present? PB_Tr10_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val == 0 && Initialized == true) // If train not present and FY is initialized and Track is enabled { LLed_Track10.BackColor = Color.Transparent; // Set Color.Transparent //PB_Tr10_Train.Hide(); // Train present? PB_Tr10_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } if (Initialized == false) // If FY is not initialized { LLed_Track10.BackColor = m_FYAppVar.TrackNotInitializedColor; // Set TrackNotInitializedColor LLed_Track10.Text = " Not Initialized"; // Set Track text //PB_Tr10_Train.Hide(); // Train present? PB_Tr10_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } PB_Tr10_Active.BackColor = LLed_Track10.BackColor; PB_Tr10_Inline.BackColor = LLed_Track10.BackColor; PB_Tr10_Train.BackColor = LLed_Track10.BackColor; break; case "LLed_Track11": if (Val >= 1 && TrackStatusLight[11] == true) // If train present and Track is active and track is enabled { LLed_Track11.BackColor = m_FYAppVar.TrackOccupiedColor; // Set TrackOccupiedColor //PB_Tr11_Train.Show(); // Train present? PB_Tr11_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val >= 1 && TrackStatusLight[11] == false) // If train present and Track is not active and track is enabled { LLed_Track11.BackColor = m_FYAppVar.TrackNotActiveColor; // Set TrackNotActiveColor (but is occupied) //PB_Tr11_Train.Show(); // Train present? PB_Tr11_Train.Image = Train; CheckWhichTrackInline(); // Sensor background color update } else if (Val == 0 && Initialized == true) // If train not present and FY is initialized and Track is enabled { LLed_Track11.BackColor = Color.Transparent; // Set Color.Transparent //PB_Tr11_Train.Hide(); // Train present? PB_Tr11_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } if (Initialized == false) // If FY is not initialized { LLed_Track11.BackColor = m_FYAppVar.TrackNotInitializedColor; // Set TrackNotInitializedColor LLed_Track11.Text = " Not Initialized"; // Set Track text //PB_Tr11_Train.Hide(); // Train present? PB_Tr11_Train.Image = null; CheckWhichTrackInline(); // Sensor background color update } PB_Tr11_Active.BackColor = LLed_Track11.BackColor; PB_Tr11_Inline.BackColor = LLed_Track11.BackColor; PB_Tr11_Train.BackColor = LLed_Track11.BackColor; break; case "LLed_Block6": if (Val >= 1) { LLed_Block6.BackColor = m_FYAppVar.TrackOccupiedColor;//Color.Lime; MoveTrainImage("LLed_Block6", true); PB_Bk6_Train.Show(); } if (Val == 0) { LLed_Block6.BackColor = Color.Transparent;// Color.Transparent; PB_Bk6_Train.Hide(); MoveTrainImage("LLed_Block6", false); } PB_Bk6_Train.BackColor = LLed_Block6.BackColor; break; case "LLed_Block7": if (Val >= 1) { LLed_Block7.BackColor = m_FYAppVar.TrackOccupiedColor;//Color.Lime; MoveTrainImage("LLed_Block7", true); PB_Bk7_Train.Show(); } if (Val == 0) { LLed_Block7.BackColor = Color.Transparent;// Color.Transparent; PB_Bk7_Train.Hide(); MoveTrainImage("LLed_Block7", false); } PB_Bk7_Train.BackColor = LLed_Block7.BackColor; break; case "LLed_TrackPower15V": if (Val >= 1) { LLed_15VTrackPower.BackColor = Color.Lime; LLed_15VTrackPower.ForeColor = Color.Black; LLed_15VTrackPower.Text = "Drive Power On"; } if (Val == 0) { LLed_15VTrackPower.BackColor = Color.Red; LLed_15VTrackPower.ForeColor = Color.Yellow; LLed_15VTrackPower.Text = "Drive Power Off"; } break; case "LLed_F10": if (Val >= 1) { LLed_F10.BackColor = Color.Yellow; LLed_F10_2_TOP.BackColor = Color.Yellow; MoveTrainImage("LLed_F10", true); } if (Val == 0) { LLed_F10.BackColor = Color.Transparent; LLed_F10_2_TOP.BackColor = Color.Transparent; MoveTrainImage("LLed_F10", false); } break; case "LLed_M10": if (Val >= 1) { LLed_M10.BackColor = Color.Lime; } if (Val == 0) { LLed_M10.BackColor = Color.Transparent; } break; case "Track_No": Track_No.Text = Convert.ToString(a); for (int i = 0; i < 12; i++) { TrackStatusLight[i] = false; } ALlPB_InlineOff(); TrackStatusLight[a] = true; TrackPB_InlineOn(a); ShiftIndicatorPos(a); if (Initialized == true) { UpdateTrackIndicatorColor(); // After/during shift update color of tracks accordingly } break; case "ForceNextTrack": ForceNextTrack.Value = Val; break; default: break; } } }