Exemplo n.º 1
0
        private void IsTrackUp()
        {
            _loadTrackMutex.WaitOne();
            //Checks the environment to see if a Track Models exists
            if (_env.TrackModel != null)
            {
                //if both are not loaded
                if (!(_redLoaded && _greenLoaded))
                {
                    if (!_redLoaded)
                    {
                        _redLoaded = true;
                        //Checks if the red line has been loaded yet
                        if (_env.TrackModel.RedLoaded)
                        {
                            _redLineData = new LineData(_env.TrackModel.requestTrackGrid(0), _env, _res);
                            _redLoaded   = true;
                            if (UnlockLogin != null)
                            {
                                UnlockLogin(this, EventArgs.Empty);
                            }
                        }
                        else
                        {
                            _redLoaded = false;
                            //_env.sendLogEntry("The Red Line has not been loaded yet.");
                        }
                    }


                    if (!_greenLoaded)
                    {
                        _greenLoaded = true;
                        //Checks if the green line has been loaded yet
                        if (_env.TrackModel.GreenLoaded)
                        {
                            _greenLineData = new LineData(_env.TrackModel.requestTrackGrid(1), _env, _res);
                            _greenLoaded   = true;
                            if (UnlockLogin != null)
                            {
                                UnlockLogin(this, EventArgs.Empty);
                            }
                        }
                        else
                        {
                            _greenLoaded = false;
                            //_env.sendLogEntry("The Green Line has not be loaded yet.");
                        }
                    }
                }
            }
            else
            {
                _env.SendLogEntry("CTCOffice: NULL Reference to TrackModel");
            }
            _loadTrackMutex.ReleaseMutex();
        }
        /// <summary>
        /// Takes Line Data From CTC Office and makes interaction possible
        /// </summary>
        private void ParseLineData()
        {
            if (InvokeRequired)
            {
                BeginInvoke(new Action(ParseLineData));
                return;
            }

            int x = 0;
            int y = 0;

            LineData red = _ctcOffice.GetLine(0);
            LineData green = _ctcOffice.GetLine(1);

            if (_redLineData != red)
            {
                _redLineData = red;

                _panelRedLine.Controls.Clear();
                for (int i = 0; i <= _redLineData.Layout.GetUpperBound(0); i++)
                {
                    for (int j = 0; j <= _redLineData.Layout.GetUpperBound(1); j++)
                    {
                        LayoutCellDataContainer container = _redLineData.Layout[i, j];
                        MakePane(i, j, x, y, container, _panelRedLine);

                        /*
                        MyPictureBox pane = new MyPictureBox(_panelRedLine,this);
                        _panelRedLine.Controls.Add(pane);
                        pane.Name = "_imgGridRed_" + i + "_" + j;
                        pane.SizeMode = PictureBoxSizeMode.CenterImage;
                        pane.Size = new Size(20, 20);
                        pane.Location = new Point(x, y);
                        pane.Image = _redLineData.Layout[i, j].Tile;
                        pane.Tag = _redLineData.Layout[i, j];
                        _redLineData.Layout[i, j].Panel = pane;
                        pane.MouseClick += _layoutPiece_MouseClick;
                        //pane.MouseHover += new EventHandler(this._layoutPiece_MouseHover);
                         */
                        x += 20;
                    }
                    y += 20;
                    x = 0;
                }
                x = 0;
                y = 0;
            } //ed process red line

            if (_greenLineData != green)
            {
                _greenLineData = green;

                _panelGreenLine.Controls.Clear();
                for (int i = 0; i <= _greenLineData.Layout.GetUpperBound(0); i++)
                {
                    for (int j = 0; j <= _greenLineData.Layout.GetUpperBound(1); j++)
                    {
                        LayoutCellDataContainer container = _greenLineData.Layout[i, j];
                        MakePane(i, j, x, y, container, _panelGreenLine);
                        /*
                        MyPictureBox pane = new MyPictureBox(_panelGreenLine,this);
                        _panelGreenLine.Controls.Add(pane);
                        pane.Name = "_imgGridGreen_" + i + "_" + j;
                        pane.SizeMode = PictureBoxSizeMode.CenterImage;
                        pane.Size = new Size(20, 20);
                        pane.Location = new Point(x, y);

                        pane.Image = _greenLineData.Layout[i, j].Tile;
                        pane.Tag = _greenLineData.Layout[i, j];

                        _greenLineData.Layout[i, j].Panel = pane;

                        pane.MouseClick += _layoutPiece_MouseClick;
                        //pane.MouseHover += new EventHandler(this._layoutPiece_MouseHover);
                         */
                        x += 20;
                    }
                    y += 20;
                    x = 0;
                }
            } //end process green
        }
Exemplo n.º 3
0
        private void IsTrackUp()
        {
            _loadTrackMutex.WaitOne();
            //Checks the environment to see if a Track Models exists
            if (_env.TrackModel != null)
            {
                //if both are not loaded
                if (!(_redLoaded && _greenLoaded))
                {
                    if (!_redLoaded)
                    {
                        _redLoaded = true;
                        //Checks if the red line has been loaded yet
                        if (_env.TrackModel.RedLoaded)
                        {
                            _redLineData = new LineData(_env.TrackModel.requestTrackGrid(0), _env, _res);
                            _redLoaded = true;
                            if (UnlockLogin != null)
                            {
                                UnlockLogin(this, EventArgs.Empty);
                            }
                        }
                        else
                        {
                            _redLoaded = false;
                            //_env.sendLogEntry("The Red Line has not been loaded yet.");
                        }
                    }

                    if (!_greenLoaded)
                    {
                        _greenLoaded = true;
                        //Checks if the green line has been loaded yet
                        if (_env.TrackModel.GreenLoaded)
                        {
                            _greenLineData = new LineData(_env.TrackModel.requestTrackGrid(1), _env, _res);
                            _greenLoaded = true;
                            if (UnlockLogin != null)
                            {
                                UnlockLogin(this, EventArgs.Empty);
                            }
                        }
                        else
                        {
                            _greenLoaded = false;
                            //_env.sendLogEntry("The Green Line has not be loaded yet.");
                        }
                    }
                }
            }
            else
            {
                _env.SendLogEntry("CTCOffice: NULL Reference to TrackModel");
            }
            _loadTrackMutex.ReleaseMutex();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Takes Line Data From CTC Office and makes interaction possible
        /// </summary>
        private void ParseLineData()
        {
            if (InvokeRequired)
            {
                BeginInvoke(new Action(ParseLineData));
                return;
            }

            int x = 0;
            int y = 0;


            LineData red   = _ctcOffice.GetLine(0);
            LineData green = _ctcOffice.GetLine(1);

            if (_redLineData != red)
            {
                _redLineData = red;

                _panelRedLine.Controls.Clear();
                for (int i = 0; i <= _redLineData.Layout.GetUpperBound(0); i++)
                {
                    for (int j = 0; j <= _redLineData.Layout.GetUpperBound(1); j++)
                    {
                        LayoutCellDataContainer container = _redLineData.Layout[i, j];
                        MakePane(i, j, x, y, container, _panelRedLine);

                        /*
                         * MyPictureBox pane = new MyPictureBox(_panelRedLine,this);
                         * _panelRedLine.Controls.Add(pane);
                         * pane.Name = "_imgGridRed_" + i + "_" + j;
                         * pane.SizeMode = PictureBoxSizeMode.CenterImage;
                         * pane.Size = new Size(20, 20);
                         * pane.Location = new Point(x, y);
                         * pane.Image = _redLineData.Layout[i, j].Tile;
                         * pane.Tag = _redLineData.Layout[i, j];
                         * _redLineData.Layout[i, j].Panel = pane;
                         * pane.MouseClick += _layoutPiece_MouseClick;
                         * //pane.MouseHover += new EventHandler(this._layoutPiece_MouseHover);
                         */
                        x += 20;
                    }
                    y += 20;
                    x  = 0;
                }
                x = 0;
                y = 0;
            } //ed process red line

            if (_greenLineData != green)
            {
                _greenLineData = green;

                _panelGreenLine.Controls.Clear();
                for (int i = 0; i <= _greenLineData.Layout.GetUpperBound(0); i++)
                {
                    for (int j = 0; j <= _greenLineData.Layout.GetUpperBound(1); j++)
                    {
                        LayoutCellDataContainer container = _greenLineData.Layout[i, j];
                        MakePane(i, j, x, y, container, _panelGreenLine);

                        /*
                         * MyPictureBox pane = new MyPictureBox(_panelGreenLine,this);
                         * _panelGreenLine.Controls.Add(pane);
                         * pane.Name = "_imgGridGreen_" + i + "_" + j;
                         * pane.SizeMode = PictureBoxSizeMode.CenterImage;
                         * pane.Size = new Size(20, 20);
                         * pane.Location = new Point(x, y);
                         *
                         * pane.Image = _greenLineData.Layout[i, j].Tile;
                         * pane.Tag = _greenLineData.Layout[i, j];
                         *
                         *
                         * _greenLineData.Layout[i, j].Panel = pane;
                         *
                         * pane.MouseClick += _layoutPiece_MouseClick;
                         * //pane.MouseHover += new EventHandler(this._layoutPiece_MouseHover);
                         */
                        x += 20;
                    }
                    y += 20;
                    x  = 0;
                }
            } //end process green
        }     //end ParseLineData