Inheritance: System.Windows.Forms.UserControl
        /// <summary>
        /// Draws the track layout
        /// </summary>
        /// <param name="blocks">List of track blocks in the layout</param>
        public void SetTrackLayout(List <TrackBlock> blocks, Size layoutSize, Point layoutPosition)
        {
            if (blocks != null)
            {
                m_layoutPosition = layoutPosition;

                //Clear the controls
                foreach (KeyValuePair <TrackBlock, TrackBlockGraphic> graphic in m_blockTable)
                {
                    Controls.Remove(graphic.Value);
                }

                m_blockTable.Clear();

                CalculateScale(layoutSize);

                foreach (TrackBlock b in blocks)
                {
                    //Create a new trackblock graphic
                    TrackBlockGraphic graphic = new TrackBlockGraphic(b, m_scale);

                    graphic.Location = CalculateBlockPosition(b, layoutPosition, graphic.ArrowLength);

                    graphic.TrackBlockClicked += OnBlockClicked;

                    Controls.Add(graphic);
                    m_blockTable[b] = graphic;
                }
            }
        }
        /// <summary>
        /// Event handler for the train graphic clicked event
        /// </summary>
        /// <param name="sender">Sender of the event</param>
        /// <param name="e">Event arguments</param>
        private void OnTrainGraphicClicked(object sender, EventArgs e)
        {
            try
            {
                TrainGraphic graphic = (TrainGraphic)sender;

                if (m_selectedTrackBlock != null)
                {
                    m_selectedTrackBlock.StopBlinking();
                }
                if (m_selectedTrain != null && m_selectedTrain != graphic)
                {
                    m_selectedTrain.StopBlinking();
                }

                m_selectedTrackBlock = null;
                m_selectedTrain      = graphic;

                blinkTimer.Start();

                if (TrainClicked != null)
                {
                    TrainClicked(graphic.Train);
                }
            }
            catch (InvalidCastException ex)
            {
                m_log.LogError(ex);
                throw ex;
            }
        }
 /// <summary>
 /// Unselects the selected graphic, if there is one
 /// </summary>
 public void UnselectAll()
 {
     if (m_selectedTrackBlock != null)
     {
         m_selectedTrackBlock.StopBlinking();
         m_selectedTrackBlock = null;
         blinkTimer.Stop();
     }
 }
 public void ArrowLengthTest1()
 {
     TrackBlock block = null; // TODO: Initialize to an appropriate value
     double scale = 0F; // TODO: Initialize to an appropriate value
     TrackBlockGraphic target = new TrackBlockGraphic(block, scale); // TODO: Initialize to an appropriate value
     int expected = 0; // TODO: Initialize to an appropriate value
     int actual;
     target.ArrowLength = expected;
     actual = target.ArrowLength;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
 public void BlinkColorTest()
 {
     TrackBlock block = null; // TODO: Initialize to an appropriate value
     double scale = 0F; // TODO: Initialize to an appropriate value
     TrackBlockGraphic target = new TrackBlockGraphic(block, scale); // TODO: Initialize to an appropriate value
     Color expected = new Color(); // TODO: Initialize to an appropriate value
     Color actual;
     target.BlinkColor = expected;
     actual = target.BlinkColor;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
 public void TrackBlockGraphicConstructorTest1()
 {
     TrackBlock block = null; // TODO: Initialize to an appropriate value
     double scale = 0F; // TODO: Initialize to an appropriate value
     TrackBlockGraphic target = new TrackBlockGraphic(block, scale);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
 public void StopBlinkingTest1()
 {
     TrackBlock block = null; // TODO: Initialize to an appropriate value
     double scale = 0F; // TODO: Initialize to an appropriate value
     TrackBlockGraphic target = new TrackBlockGraphic(block, scale); // TODO: Initialize to an appropriate value
     target.StopBlinking();
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
 public void ShowDotTest1()
 {
     TrackBlock block = null; // TODO: Initialize to an appropriate value
     double scale = 0F; // TODO: Initialize to an appropriate value
     TrackBlockGraphic target = new TrackBlockGraphic(block, scale); // TODO: Initialize to an appropriate value
     bool expected = false; // TODO: Initialize to an appropriate value
     bool actual;
     target.ShowDot = expected;
     actual = target.ShowDot;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }