/// <summary> /// Event handler for the track block clicked event /// </summary> /// <param name="b">Track block that was clicked</param> private void OnTrackBlockClicked(TrackBlock b) { m_log.LogInfo("Track block was clicked"); m_selectedTrain = null; m_selectedTrackBlock = b; if (m_trainGUI != null) { m_trainGUI.Close(); m_trainGUI = null; } if (m_simulatorWindow == null || m_simulatorWindow.IsDisposed || m_simulatorWindow.Disposing) { m_simulatorWindow = new SimulatorWindow(); //User may have closed the simulator m_simulatorWindow.Show(); } m_simulatorWindow.SetSelectedTrackBlock(m_selectedTrackBlock); if (b != null) { bool trainYard = false; if (b.HasTransponder) { if (!string.IsNullOrEmpty(b.Transponder.StationName)) { if (b.Transponder.StationName.Contains(Constants.TRAINYARD) && b.Transponder.DistanceToStation == 0) { //This is a train yard, handle it specially infoPanel.SetTrainYardInfo(b); commandPanel.ShowTrainYardCommands(); trainYard = true; } } } if (!trainYard) { //Normal track block infoPanel.SetTrackBlockInfo(b); commandPanel.ShowTrackBlockCommands(b); } } CloseOpenPopups(); }
/// <summary> /// Event handler for the track block clicked event /// </summary> /// <param name="b">Track block that was clicked</param> private void OnTrackBlockClicked(TrackBlock b) { m_log.LogInfo("Track block was clicked"); m_selectedTrain = null; m_selectedTrackBlock = b; if (m_trainGUI != null) { m_trainGUI.Close(); m_trainGUI = null; } if (m_simulatorWindow == null || m_simulatorWindow.IsDisposed || m_simulatorWindow.Disposing) { m_simulatorWindow = new SimulatorWindow(); //User may have closed the simulator m_simulatorWindow.Show(); } m_simulatorWindow.SetSelectedTrackBlock(m_selectedTrackBlock); if (b != null) { bool trainYard = false; if (b.HasTransponder) { if (!string.IsNullOrEmpty(b.Transponder.StationName)) { if (b.Transponder.StationName.Contains(Constants.TRAINYARD) && b.Transponder.DistanceToStation == 0) { //This is a train yard, handle it specially infoPanel.SetTrainYardInfo(b); commandPanel.ShowTrainYardCommands(); trainYard = true; } } } if (!trainYard) { //Normal track block infoPanel.SetTrackBlockInfo(b); commandPanel.ShowTrackBlockCommands(b); } } CloseOpenPopups(); }