public AuthorityTool(CTCOfficeGUI ctcgui, CTCOffice ctc, ISimulationEnvironment env)
 {
     InitializeComponent();
     _ctc = ctc;
     _ctcgui = ctcgui;
     _env = env;
 }
 public AuthorityTool(CTCOfficeGUI ctcgui, CTCOffice ctc, ISimulationEnvironment env)
 {
     InitializeComponent();
     _ctc    = ctc;
     _ctcgui = ctcgui;
     _env    = env;
 }
Esempio n. 3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Environment
            env = new SimulationEnvironment.SimulationEnvironment();

            // TrackModel
            TrackModel.TrackModel trackModel = new TrackModel.TrackModel(env);
            env.TrackModel = trackModel;
            TrackModel.TrackModelGUI trackModelGui = new TrackModelGUI(env, trackModel);

            // CTCOffice
            CTCOffice.CTCOffice ctcOffice = new CTCOffice.CTCOffice(env, env.PrimaryTrackControllerRed, env.PrimaryTrackControllerGreen);
            env.CTCOffice = ctcOffice;
            CTCOffice.CTCOfficeGUI ctcOfficeGui = new CTCOfficeGUI(env, ctcOffice);
            ctcOfficeGui.ShowTrain += new EventHandler<ShowTrainEventArgs>(ctcOfficeGui_ShowTrain);
            ctcOfficeGui.ShowSchedule += new EventHandler<EventArgs>(ctcOfficeGui_ShowSchedule);

            // Scheduler
            SystemScheduler.SystemScheduler scheduler = new SystemScheduler.SystemScheduler(env, ctcOffice);
            env.SystemScheduler = scheduler;
            SystemScheduler.SystemSchedulerGUI schedulerGui = new SystemScheduler.SystemSchedulerGUI(env, scheduler, ctcOffice);

            // train model form
            TrainModel.TrainGUI trainGui = new TrainGUI(env);

            // Track Controllers
            if (env.PrimaryTrackControllerRed != null)
            {
                TrackController.TrackController red = (TrackController.TrackController)env.PrimaryTrackControllerRed;
                TrackControllerUi redTcGui = new TrackControllerUi(env, red);
                trackControllerRedForm = new Form() { Controls = { redTcGui }, TopLevel = true, AutoSize = true, Parent = null, Text = "Terminal Velocity - Track Controller Red" };
            }

            if (env.PrimaryTrackControllerGreen != null)
            {
                TrackController.TrackController green = (TrackController.TrackController)env.PrimaryTrackControllerGreen;
                TrackControllerUi greenTcGui = new TrackControllerUi(env, green);
                trackControllerGreenForm = new Form() { Controls = { greenTcGui }, TopLevel = true, AutoSize = true, Parent = null, Text = "Terminal Velocity - Track Controller Green" };
            }

            ctcForm = new Form() { Controls = { ctcOfficeGui }, AutoSize = true, Text="Terminal Velocity - CTC Office"};
            schedulerForm = new Form() { Controls = { schedulerGui }, TopLevel = true, AutoSize = true, Parent = null, Text="Terminal Velocity - System Scheduler" };
            trackModelForm = new Form() { Controls = { trackModelGui }, TopLevel = true, AutoSize = true, Parent = null, Text="Terminal Velocity - Track Model"};
            trainModelForm = new Form() { Controls = { trainGui }, TopLevel = true, AutoSize = true, Parent = null, Text = "Terminal Velocity - Trains" };

            //TODO
            /*
             * Train Controller Form(s)
             * Train Model Form
            */

            ctcForm.Shown += new EventHandler(ctcForm_Shown);

            Application.Run(ctcForm);
        }
        public CTCGUITest()
        {
            //using all testing classes the ctc office (created a new instance of ctc)

            //create environment instance
            _env = new SimulationEnvironment.SimulationEnvironment();

            //create testing track model
            _trackMod = new TestingTrackModel(_env);

            //creating testing track controllers
            _red   = new TestingTrackController(0, _trackMod, _env, true);
            _green = new TestingTrackController(1, _trackMod, _env, true);

            //hook to environment
            _env.PrimaryTrackControllerRed   = _red;
            _env.PrimaryTrackControllerGreen = _green;
            _env.TrackModel = _trackMod;

            //creating office instance
            _ctc = new CTCOffice.CTCOffice(_env, _red, _green);

            _env.CTCOffice        = _ctc;
            _ctc.StartAutomation += new EventHandler <EventArgs>(_ctc_StartAutomation);
            _ctc.StopAutomation  += new EventHandler <EventArgs>(_ctc_StopAutomation);

            //making Request Panel Objects (For red and green)
            _redRequest   = new RequestFrame("Red", _red);
            _greenRequest = new RequestFrame("Green", _green);

            //creating office gui
            _ctcGui = new CTCOfficeGUI(_env, _ctc);
            _ctcGui.ShowSchedule += new EventHandler <EventArgs>(_ctcGui_ShowSchedule);


            var MyTestingControls = new TestingControls(_trackMod);

            //creating testing gui
            _control = new OfficeGUITest(
                _ctcGui,
                _redRequest,
                _greenRequest,
                MyTestingControls
                );

            _env.StartTick();

            Form f = new Form();

            f.AutoSize = true;
            f.Text     = "CTC Office Standalone GUI Test";
            f.Controls.Add(_control);
            f.Show();
        }
        public CTCGUITest()
        {
            //using all testing classes the ctc office (created a new instance of ctc)

            //create environment instance
            _env = new SimulationEnvironment.SimulationEnvironment();

            //create testing track model
            _trackMod = new TestingTrackModel(_env);

            //creating testing track controllers
            _red = new TestingTrackController(0,_trackMod,_env, true);
            _green = new TestingTrackController(1,_trackMod,_env, true);

            //hook to environment
            _env.PrimaryTrackControllerRed = _red;
            _env.PrimaryTrackControllerGreen = _green;
            _env.TrackModel = _trackMod;

            //creating office instance
            _ctc = new CTCOffice.CTCOffice(_env, _red, _green);

            _env.CTCOffice = _ctc;
            _ctc.StartAutomation += new EventHandler<EventArgs>(_ctc_StartAutomation);
            _ctc.StopAutomation += new EventHandler<EventArgs>(_ctc_StopAutomation);

            //making Request Panel Objects (For red and green)
            _redRequest = new RequestFrame("Red", _red);
            _greenRequest = new RequestFrame("Green", _green);

            //creating office gui
            _ctcGui = new CTCOfficeGUI(_env, _ctc);
            _ctcGui.ShowSchedule += new EventHandler<EventArgs>(_ctcGui_ShowSchedule);

            var MyTestingControls = new TestingControls(_trackMod);
            //creating testing gui
            _control = new OfficeGUITest(
                _ctcGui,
                _redRequest,
                _greenRequest,
                MyTestingControls
                );

            _env.StartTick();

            Form f = new Form();
            f.AutoSize = true;
            f.Text = "CTC Office Standalone GUI Test";
            f.Controls.Add(_control);
            f.Show();
        }
        public OfficeGUITest(CTCOfficeGUI ctc, RequestFrame red, RequestFrame green, TestingControls tc)
        {
            InitializeComponent();
            _panelCTC.Controls.Clear();
            _panelCTC.Controls.Add(ctc);

            _panelRequestRed.Controls.Clear();
            _panelRequestRed.Controls.Add(red);

            _panelRequestGreen.Controls.Clear();
            _panelRequestGreen.Controls.Add(green);

            _panelTestingControls.Controls.Clear();
            _panelTestingControls.Controls.Add(tc);
        }
        public OfficeGUITest(CTCOfficeGUI ctc, RequestFrame red, RequestFrame green, TestingControls tc)
        {
            InitializeComponent();
            _panelCTC.Controls.Clear();
            _panelCTC.Controls.Add(ctc);

            _panelRequestRed.Controls.Clear();
            _panelRequestRed.Controls.Add(red);

            _panelRequestGreen.Controls.Clear();
            _panelRequestGreen.Controls.Add(green);

            _panelTestingControls.Controls.Clear();
            _panelTestingControls.Controls.Add(tc);
        }
        public RoutingTool(CTCOfficeGUI ctcgui, CTCOffice ctc, ISimulationEnvironment env, IBlock sBlock, bool mode)
        {
            InitializeComponent();

            //mode = true for dispatch, mode = flase for update
            _btnPoint.Enabled = !mode;

            _ctc        = ctc;
            _ctcGui     = ctcgui;
            _env        = env;
            _startBlock = sBlock;

            _ctcGui.RoutingToolResponse += _ctcGui_RoutingToolResponse;

            _endBlock = null;
        }
        public RoutingTool(CTCOfficeGUI ctcgui, CTCOffice ctc, ISimulationEnvironment env, IBlock sBlock, bool mode)
        {
            InitializeComponent();

            //mode = true for dispatch, mode = flase for update
            _btnPoint.Enabled = !mode;

            _ctc = ctc;
            _ctcGui = ctcgui;
            _env = env;
            _startBlock = sBlock;

            _ctcGui.RoutingToolResponse += _ctcGui_RoutingToolResponse;

            _endBlock = null;
        }
        public void createCTCOfficeForm()
        {
            var formCTC = new Form();
            CTCOfficeGUI controlCTC;
            controlCTC = new CTCOfficeGUI(_env, _office);

            controlCTC.ShowTrain += controlCTC_ShowTrain;
            controlCTC.ShowSchedule += controlCTC_ShowSchedule;

            formCTC.Text = "CTC Office";
            formCTC.Controls.Add(controlCTC);
            formCTC.AutoSize = true;
            formCTC.ShowDialog();
        }