Exemple #1
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     Model      = new SimulatorModel(new MyTelnetClient());
     ControlsVM = new ControlsVM(model);
     MapVM      = new MapVM(model);
     DashVM     = new DashBoardVM(model);
     errorVM    = new ErrorVm(model);
 }
Exemple #2
0
        // Initializing the simulator model and all the view models.
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            ISimulatorModel simulatorModel = new SimulatorModel(new MyTelnetClient());

            ConnectVM      = new ConnectVM(simulatorModel);
            DashboardVM    = new DashboardVM(simulatorModel);
            ControlBoardVM = new ControlBoardVM(simulatorModel);
            MapVM          = new MapVM(simulatorModel);
        }
Exemple #3
0
        private void App_Startup(Object sender, StartupEventArgs e)
        {
            Regex ValidIPRegex =
                new Regex(
                    "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$");

            /* View */
            MainWindow mainWindow = new MainWindow();

            /* Model */
            SimulatorModel model = new SimulatorModel();

            /* No Args (or not enough) args so use default values */
            model.Ip   = DEFAULT_IP;
            model.Port = DEFAULT_PORT;
            int port = -1;

            /* Try to parse arguments into ip and port */
            foreach (string curArg in e.Args)
            {
                if (ValidIPRegex.IsMatch(curArg))
                {
                    model.Ip = curArg;
                }
                else if (int.TryParse(curArg, out port) && port >= 0 && port <= 65535)
                {
                    model.Port = port;
                }
            }


            /* View Model */
            mainWindow.MyMap.SetVM(new MapVM(model));
            mainWindow.MyConnectionButtons.SetVM(new ConnectionButtonsVM(model));
            mainWindow.MyCockpitDashboard.SetVM(new CockpitDashboardVM(model));
            mainWindow.MyCockpitControls.setVM(new CockpitControlsVM(model));

            mainWindow.Show();
        }
        private void Application_Startup(Object sender, StartupEventArgs e)
        {
            ISimulatorModel model = new SimulatorModel(new TelnetClient());

            ViewModel = new VM_Main(model);
        }