public AppWindow(MyFlightSimulatorModel model, MainWindow main, IVM vm) { InitializeComponent(); // initializing the main wondow fields and the vm field this._main = main; this.vm = vm; // creating the view model of the dashboard DashboardVM dashboardVM = new DashboardVM(model); myDashboard.DataContext = dashboardVM; // creating the view model of the map MapVM mapVM = new MapVM(model); myMap.DataContext = mapVM; // creating the view model of the joystick JoystickVM joystickVm = new JoystickVM(model); myControlPlane.DataContext = joystickVm; myControlPlane.myJoystick.DataContext = joystickVm; // creating the view model of the dashboard errors myDashboardErrors.DataContext = dashboardVM; }
/*private void Application_Startup(object sender, StartupEventArgs e) * { * Model m = new Model(); * Connection_VM cvm = new Connection_VM(m); * Map_VM map_vm = new Map_VM(m); * INotifyPropertyChanged vm_panel = new VM_Panel(m); * INotifyPropertyChanged vm_navigator = new VM_Navigator(m); * this.Map = new views.Map(map_vm); * this.Connection = new views.Connection(cvm); * this.panel = new Panel(); * }*/ protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); this.model = new Model(); INotifyPropertyChanged vmPanel = new VMPanel(model); INotifyPropertyChanged vmNavigator = new VMNavigator(model); INotifyPropertyChanged mapVm = new MapVM(model); ConnectionVM cvm = new ConnectionVM(model); INotifyPropertyChanged errorsVm = new ErrorDisplayVM(model); Connection connection = new views.Connection(cvm); MainWindow my_window = new MainWindow(); my_window.panel.DataContext = vmPanel; my_window.navigator.DataContext = vmNavigator; //my_window.map.DataContext = mapVm; my_window.map.SetVM((MapVM)mapVm); my_window.errors.DataContext = errorsVm; Grid grid = ((Grid)my_window.FindName("Grid")); grid.Children.Add(connection); Grid.SetRow(connection, 1); Grid.SetColumn(connection, 1); Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); this.port = config.AppSettings.Settings["Port"].Value; this.ip = config.AppSettings.Settings["IP"].Value; my_window.Show(); }
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); }
// 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); }