コード例 #1
0
        /// <summary>
        /// Updates Green Line
        /// </summary>
        private void UpdateGreen()
        {
            _updateTrackMutex.WaitOne();
            //request blocks in green line
            IRouteInfo rtnfo = _env.TrackModel.requestRouteInfo(1);

            foreach (IBlock b in rtnfo.BlockList)
            {
                //find block in layout and change image
                LayoutCellDataContainer c = _greenLineData.TriangulateContainer(b);
                if (c != null)
                {
                    c.Tile = _greenLineData.GetBlockType(b);
                    if (c.Panel != null)
                    {
                        string msg = "Red Line: Block ID: " + c.Block.BlockID + " is now " + c.Block.State.ToString();
                        _messages.Add(msg);
                        _env.SendLogEntry("CTC Office: " + msg);
                        c.Panel.ReDrawMe();
                    }
                }
            }
            rtnfo = null;
            _updateTrackMutex.ReleaseMutex();
        }
コード例 #2
0
        }     //end track changed

        /// <summary>
        /// Updates Red Line
        /// </summary>
        private void UpdateRed()
        {
            _updateTrackMutex.WaitOne();
            //request blocks in red line
            IRouteInfo rtnfo = _env.TrackModel.requestRouteInfo(0);

            foreach (IBlock b in rtnfo.BlockList)
            {
                //find block in layout and change image
                //speed limit of 500 is unique to block id 0 (yard) on both red and green line
                if (b.SpeedLimit != 500)
                {
                    LayoutCellDataContainer c = _redLineData.TriangulateContainer(b);
                    if (c != null)
                    {
                        c.Tile = _redLineData.GetBlockType(b);
                        if (c.Panel != null)
                        {
                            string msg = "Red Line: Block ID: " + c.Block.BlockID + " is now " + c.Block.State.ToString();
                            _messages.Add(msg);
                            _env.SendLogEntry("CTC Office: " + msg);
                            c.Panel.ReDrawMe();
                        }
                    }
                }
            }
            rtnfo = null;
            _updateTrackMutex.ReleaseMutex();
        }