コード例 #1
0
        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();
        }
コード例 #2
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);
        }