Inheritance: System.Windows.Forms.Form
Exemple #1
0
        /// <summary>
        /// User selected the view simulator window menu item
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnViewSimulatorWindowClicked(object sender, EventArgs e)
        {
            if (m_simulatorWindow == null || m_simulatorWindow.IsDisposed || m_simulatorWindow.Disposing)
            {
                m_simulatorWindow = new SimulatorWindow();
                m_simulatorWindow.SetSelectedTrackBlock(m_selectedTrackBlock);
            }

            m_simulatorWindow.WindowState = FormWindowState.Normal;
            m_simulatorWindow.Show();
        }
Exemple #2
0
        /// <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();
        }
 public void SimulatorWindowConstructorTest1()
 {
     SimulatorWindow target = new SimulatorWindow();
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
 public void SetSelectedTrackBlockTest1()
 {
     SimulatorWindow target = new SimulatorWindow(); // TODO: Initialize to an appropriate value
     TrackBlock block = null; // TODO: Initialize to an appropriate value
     target.SetSelectedTrackBlock(block);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Exemple #5
0
        /// <summary>
        /// User selected the view simulator window menu item
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnViewSimulatorWindowClicked(object sender, EventArgs e)
        {
            if (m_simulatorWindow == null || m_simulatorWindow.IsDisposed || m_simulatorWindow.Disposing)
            {
                m_simulatorWindow = new SimulatorWindow();
                m_simulatorWindow.SetSelectedTrackBlock(m_selectedTrackBlock);
            }

            m_simulatorWindow.WindowState = FormWindowState.Normal;
            m_simulatorWindow.Show();
        }
Exemple #6
0
        /// <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();
        }