Ejemplo n.º 1
0
 /** The connect button set the data context of our crtical elements to be the new view
  * model the was created. (Data context also can be in xaml but here is much more clear
  * what are the crucial elements).
  */
 private void ConnectButton(object sender, RoutedEventArgs e)
 {
     viewModel   = new FlightBoardViewModel(new InfoServer(), new CommandServer());
     DataContext = viewModel;
     this.FlBoard.DataContext        = viewModel;
     this.throttleSlider.DataContext = viewModel;
     this.rudderSlider.DataContext   = viewModel;
     this.JoyStickView.DataContext   = viewModel;
     viewModel.PropertyChanged      += this.FlBoard.Vm_PropertyChanged;
 }
Ejemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();
            NetworkConnection   generalTelnet = new NetworkConnection();
            MainWindowViewModel myViewModel   = new MainWindowViewModel(new MainWindowModel(generalTelnet));

            this.DataContext = myViewModel;

            FlightBoardViewModel flightBoardViewModel = new FlightBoardViewModel(new FlightBoardModel(generalTelnet));

            this.flightBoardView.SetVM(flightBoardViewModel);
            this.flightBoardView.DataContext = flightBoardViewModel;

            CommandCenterUCVM ccucvm = new CommandCenterUCVM(new CommandCenterUCModel(generalTelnet));

            this.commandCenterUCView.SetVM(ccucvm);
        }
Ejemplo n.º 3
0
        //CTOR
        public MainWindow()
        {
            InitializeComponent();
            IMainWinModel m = new MainWinMod(AutoPilotBox);

            vm = new ManuelPilotViewModel(m, joystick);
            FlightBoardViewModel fvm = new FlightBoardViewModel(m);
            AutoPilotViewModel   avm = new AutoPilotViewModel(m);

            osvm                      = new OtherStuffViewModel(m);
            flightBoard.VM            = fvm;
            m.PropertyChanged        += fvm.Model_PropertyChanged;
            joystick.Moved           += vm.JoyStick_Handler;
            this.DataContext          = vm;
            autoPilotButt.DataContext = avm;
            clearButt.DataContext     = avm;
            connectButt.DataContext   = osvm;
            settButt.DataContext      = osvm;
            Application.Current.MainWindow.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);
        }
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new FlightBoardViewModel(FlightSimulatorModel.Instance);
 }
Ejemplo n.º 5
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new FlightBoardViewModel();
 }