/// <summary>
/// Event handler for the track block clicked event
/// </summary>
/// <param name="sender">Sender of the event</param>
/// <param name="e">Event arguments</param>
private void OnBlockClicked(object sender, EventArgs e)
{
try
{
TrackBlockGraphic graphic = (TrackBlockGraphic)sender;
if (m_selectedTrackBlock != null && m_selectedTrackBlock != graphic)
{
m_selectedTrackBlock.StopBlinking();
}
if (m_selectedTrain != null)
{
m_selectedTrain.StopBlinking();
}
m_selectedTrain = null;
m_selectedTrackBlock = graphic;
blinkTimer.Start();
if (TrackBlockClicked != null)
{
TrackBlockClicked(graphic.Block);
}
}
catch (InvalidCastException ex)
{
m_log.LogError(ex);
throw ex;
}
}