public MainViewModel(MySimulatorModel model) { this.model = model; this.connectViewModel = new ConnectViewModel(this.model); this.dashboardViewModel = new DashboardViewModel(this.model); this.joystickViewModel = new JoystickViewModel(this.model); this.mapViewModel = new MapViewModel(this.model); }
public Errors_VM(MySimulatorModel m) { this.model = m; m.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged("VM_" + e.PropertyName); }; }
public ConnectViewModel(MySimulatorModel model) { this.model = model; // every time the model notify about change, the vm also notify about change model.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged("VM_" + e.PropertyName); }; }
public View(string port, string ip) { int tempPort; // Connect settings - client and server. telnetClient = new MyTelnetClient(); Application.Current.Properties["model"] = new MySimulatorModel(telnetClient); mySimulator = (MySimulatorModel)Application.Current.Properties["model"]; // Define all controls in the view window. joystickViewModel = new JoystickViewModel(mySimulator); dashboardViewModel = new DashboardViewModel(mySimulator); errorViewModel = new ErrorViewModel(mySimulator); mapViewModel = new MapViewModel(mySimulator); // Checks the reseve port. try { tempPort = int.Parse(port); } catch { Console.WriteLine("Error - worng formt of port"); tempPort = 0; } if (mySimulator.connect(ip, tempPort) == 0) { mySimulator.start(); } InitializeComponent(); Joystick.DataContext = joystickViewModel; dash.DataContext = dashboardViewModel; error.DataContext = errorViewModel; map.DataContext = mapViewModel; disconnect.DataContext = mapViewModel; }
public MySimulatorViewModel(ISimulatorModel sm) { this.model = sm; model.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { OnPropertyChanged("VM_" + e.PropertyName); if (e.PropertyName.ToLower().Contains("lon") || e.PropertyName.ToLower().Contains("lat")) { MySimulatorModel se = sender as MySimulatorModel; lon = se.longitude; lat = se.latitude; Location loc = new Location(lat, lon); VM_Location = loc; } }; Err_visiblity_Cannot_Connect = Visibility.Collapsed; model.Err_Server_Format = Visibility.Collapsed; VM_Err_visiblity_Not_Connected = Visibility.Visible; model.Err_Server_IO = Visibility.Collapsed; color = new SolidColorBrush(); color.Color = System.Windows.Media.Color.FromRgb(255, 0, 0); VM_Color = color; VM_Ip_address = "127.0.0.1"; VM_Info_port = "5402"; VM_Command_port = "5400"; settings_ip_saved = VM_Ip_address; settings_info_port_saved = VM_Info_port; settings_command_port_saved = VM_Command_port; Settings_Cancel_Click = new RelayCommand(SettingsCancelClicked); Settings_Ok_Click = new RelayCommand(SettingsOkClicked); MW_ConnectCommand = new RelayCommand(connect); }
// Ctor for the Joystick ViewModel. public JoystickViewModel(MySimulatorModel model) { this.model = model; model.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged("VM_" + e.PropertyName); }; }
public MainViewModel(MySimulatorModel model) { this.model = model; this.connectViewModel = new ConnectViewModel(this.model); }
public CommandController(MySimulatorModel flightGear1) { flightGear = flightGear1; }