Exemplo n.º 1
0
        public TrackSettingsModal()
        {
            InitializeComponent();

            //ayarları okuma
            m_settings = XMLSerialization.Singleton();
            m_settings = m_settings.DeSerialize(m_settings);

            //m_dataGridViewTrackRoute.Columns.Clear();

            if (m_settings.RouteTrack.TableName == "")
            {
                m_dataGridViewManuelInputTrack.DataSource = TempDataTable();
            }
            else
            {
                m_dataGridViewManuelInputTrack.DataSource = m_settings.RouteTrack;
            }

            m_dataGridViewManuelInputTrack.Columns[0].Width = 50;

            UIOperation.SetDoubleBuffered(m_dataGridViewManuelInputTrack);
            UIOperation.SetDoubleBuffered(m_dataGridViewFromFileTrack);



            m_dataGridViewFromFileTrack.DataSource = MainForm.m_fromFileTracks;

            m_dataGridViewFromFileTrack.Columns[0].Width = 50;
        }
Exemplo n.º 2
0
        public GeneralSettingsModal()
        {
            InitializeComponent();

            //ayarları okuma
            m_settings = XMLSerialization.Singleton();
            m_settings = m_settings.DeSerialize(m_settings);



            m_textBoxStartRangeTrackID.Text = m_settings.StartTrackID.ToString();
            m_textBoxEndRangeTrackID.Text   = m_settings.EndTrackID.ToString();


            if (m_settings.TrackInput == Enums.TrackInput.Manuel)
            {
                m_radioButtonManuelInputTracks.Checked = true;
            }
            else
            {
                m_radioButtonFromFileTracks.Checked = true;
            }



            m_numericUpDownTrainFrequency.Value = m_settings.TrainFrequency;
        }
Exemplo n.º 3
0
        public MainForm()
        {
            InitializeComponent();

            m_mf = this;

            #region ayarları okuma
            m_settings = XMLSerialization.Singleton();
            m_settings = m_settings.DeSerialize(m_settings);
            #endregion

            CheckForIllegalCrossThreadCalls = false;

            m_allOBATP            = new ConcurrentDictionary <int, OBATP>();
            m_socketCommunication = SocketCommunication.Singleton();
            m_trainMovement       = new TrainMovementCreate();

            //excel tablosundan track listesini ve özelliklerini okuyoruz
            m_fromFileTracks = FileOperation.ReadTrackTableInExcel();


            if (m_settings.TrackInput == Enums.TrackInput.Manuel)
            {
                allTracks = Track.AllTracksAAA(m_settings.RouteTrack);
            }
            else if (m_settings.TrackInput == Enums.TrackInput.FromFile)
            {
                allTracks = Track.AllTracks(m_fromFileTracks);
            }



            m_route = Route.CreateNewRoute(m_settings.StartTrackID, m_settings.EndTrackID, allTracks);


            //DataTable rt = FileOperation.ReadRouteTableInExcel();
            //allRoute = Route.AllRoute(rt, asasas);

            //Route route = new Route();
            //allRoute = route.AllRoute(rt, asasas);


            //List<Route> asdasdasdasdasd =  Route.AllRoute(rt, allTracks);



            ahmet.Columns.Add("ID");


            UIOperation.SetDoubleBuffered(m_listViewFootPrintTracks);
            UIOperation.SetDoubleBuffered(m_listViewVirtualOccupation);


            //m_socketCommunication.Start(SocketCommunication.CommunicationType.Client, "10.2.149.17", 205);
            m_socketCommunication.Start(SocketCommunication.CommunicationType.Client, "127.0.0.1", 5050);
        }
Exemplo n.º 4
0
        public TrainSettingsModal()
        {
            InitializeComponent();

            //ayarları okuma
            m_settings = XMLSerialization.Singleton();
            m_settings = m_settings.DeSerialize(m_settings);

            //ayarları atama
            m_textBoxTrainLength.Text       = m_settings.TrainLength.ToString();
            m_textBoxTrainDeceleration.Text = m_settings.MaxTrainDeceleration.ToString();
            m_textBoxTrainAcceleration.Text = m_settings.MaxTrainAcceleration.ToString();
            m_textBoxTrainSpeedLimit.Text   = m_settings.TrainSpeedLimit.ToString();
        }
Exemplo n.º 5
0
        private void m_buttonSave_Click(object sender, EventArgs e)
        {
            m_settings.TrainLength          = Convert.ToInt32(m_textBoxTrainLength.Text);
            m_settings.MaxTrainDeceleration = Convert.ToDouble(m_textBoxTrainDeceleration.Text);
            m_settings.MaxTrainAcceleration = Convert.ToDouble(m_textBoxTrainAcceleration.Text);
            m_settings.TrainSpeedLimit      = Convert.ToInt32(m_textBoxTrainSpeedLimit.Text);

            m_settings.Serialize(m_settings);

            m_settings = m_settings.DeSerialize(m_settings);

            if ((Button)sender == m_buttonApply)
            {
                this.Close();
            }
        }
Exemplo n.º 6
0
        private void m_buttonSave_Click(object sender, EventArgs e)
        {
            DataTable dT = (DataTable)m_dataGridViewManuelInputTrack.DataSource;

            m_settings.RouteTrack = dT;

            m_settings.Serialize(m_settings);

            m_settings = m_settings.DeSerialize(m_settings);



            if ((Button)sender == m_buttonApply)
            {
                this.Close();
            }
        }
Exemplo n.º 7
0
        private void m_buttonSave_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < m_checkedListBoxTrains.Items.Count; i++)
            {
                CheckState cs = m_checkedListBoxTrains.GetItemCheckState(i);

                if (cs == CheckState.Checked)
                {
                    m_settings.Trains.Add(i);
                }
                else if (cs == CheckState.Unchecked)
                {
                    m_settings.Trains.Remove(i);
                }
            }


            m_settings.TrainFrequency = m_numericUpDownTrainFrequency.Value;



            m_settings.StartTrackID = Convert.ToInt32(m_textBoxStartRangeTrackID.Text);
            m_settings.EndTrackID   = Convert.ToInt32(m_textBoxEndRangeTrackID.Text);

            if (m_radioButtonManuelInputTracks.Checked)
            {
                m_settings.TrackInput = Enums.TrackInput.Manuel;
            }

            if (m_radioButtonFromFileTracks.Checked)
            {
                m_settings.TrackInput = Enums.TrackInput.FromFile;
            }


            m_settings.Serialize(m_settings);

            m_settings = m_settings.DeSerialize(m_settings);

            if ((Button)sender == m_buttonApply)
            {
                this.Close();
            }
        }
Exemplo n.º 8
0
        public TrainSimModal()
        {
            InitializeComponent();

            //ayarları okuma
            m_settings = XMLSerialization.Singleton();
            m_settings = m_settings.DeSerialize(m_settings);


            TrainLengthCM        = (double)m_settings.TrainLength;
            TrainLengthCMReScale = (TrainLengthCM * RouteScaleRatio);


            m_rect = new Rectangle(offsetX, 100, Convert.ToInt32(TrainLengthCMReScale), 20);

            m_bitmapGraphics = m_panel.CreateGraphics();// Graphics.FromImage(m_bitmapScreen);

            UIOperation.SetDoubleBuffered(m_panel);

            MainForm.m_trainMovement.AddWatcher(this);
        }
        public CommunicationSettingsModal()
        {
            InitializeComponent();

            //ayarları okuma
            m_settings = XMLSerialization.Singleton();
            m_settings = m_settings.DeSerialize(m_settings);


            //ayarları atama
            m_ıpAddressControlATSToOBATP.Text = m_settings.ATSToOBATPIPAddress;
            m_textBoxATSToOBATPPort.Text      = m_settings.ATSToOBATPPort;

            m_ıpAddressControlOBATPToATS.Text = m_settings.OBATPToATSIPAddress;
            m_textBoxOBATPToATSPort.Text      = m_settings.OBATPToATSPort;

            m_ıpAddressControlWSATCToOBATP.Text = m_settings.WSATCToOBATPIPAddress;
            m_textBoxWSATCToOBATPPort.Text      = m_settings.WSATCToOBATPPort;

            m_ıpAddressControlOBATPToWSATC.Text = m_settings.OBATPToWSATCIPAddress;
            m_textBoxOBATPToWSATCPort.Text      = m_settings.OBATPToWSATCPort;
        }
        private void m_buttonSave_Click(object sender, EventArgs e)
        {
            m_settings.ATSToOBATPIPAddress = m_ıpAddressControlATSToOBATP.Text;
            m_settings.ATSToOBATPPort      = m_textBoxATSToOBATPPort.Text;

            m_settings.OBATPToATSIPAddress = m_ıpAddressControlOBATPToATS.Text;
            m_settings.OBATPToATSPort      = m_textBoxOBATPToATSPort.Text;

            m_settings.WSATCToOBATPIPAddress = m_ıpAddressControlWSATCToOBATP.Text;
            m_settings.WSATCToOBATPPort      = m_textBoxWSATCToOBATPPort.Text;

            m_settings.OBATPToWSATCIPAddress = m_ıpAddressControlOBATPToWSATC.Text;
            m_settings.OBATPToWSATCPort      = m_textBoxOBATPToWSATCPort.Text;


            m_settings.Serialize(m_settings);
            m_settings = m_settings.DeSerialize(m_settings);

            if ((Button)sender == m_buttonApply)
            {
                this.Close();
            }
        }
Exemplo n.º 11
0
        private void m_backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            m_settings = m_settings.DeSerialize(m_settings);
            //List<Track> route = Route.CreateNewRoute(10101, 10103, allTracks);


            Stopwatch sw = new Stopwatch();


            int counter = 0;


            OBATPPool <OBATP> pool = new OBATPPool <OBATP>(() => new OBATP());


            foreach (var item in m_settings.Trains)
            {
                counter++;


                int    trainIndex = item;
                string trainName  = "Train" + (trainIndex + 1).ToString();

                DataRow row2 = m_dataTable.NewRow();
                row2["ID"]         = counter;
                row2["Train_Name"] = trainName;
                m_dataTable.Rows.Add(row2);

                // DisplayManager.RichTextBoxInvoke(m_richTextBox, trainName + " is Created...", Color.Black);



                OBATP oBATP = new OBATP(Enums.Train_ID.Train1, trainName, m_settings.MaxTrainAcceleration, m_settings.MaxTrainDeceleration, m_settings.TrainSpeedLimit, m_settings.TrainLength, m_route);



                //pool.PutObject(oBATP);


                // //m_allOBATP.TryAdd(trainIndex, oBATP);
                // //m_allOBATP.AddOrUpdate(trainIndex, oBATP, (s, i) => oBATP);

                // oBATP.RequestStartProcess();


                // int sleepTime = Convert.ToInt32(m_settings.TrainFrequency);

                // sw.Start();



                // while (sw.Elapsed.TotalSeconds < (sleepTime))
                // {

                // }

                // sw.Reset();
            }


            //OBATP dsfregr = pool.GetObject();
        }