public Joystick(Flight_Model model) { InitializeComponent(); vm = new VM_Joystick(model); DataContext = vm; // ... }
public details(Flight_Model model) { InitializeComponent(); vm = new VM_details(model); DataContext = vm; // ... }
public VM_Joystick(Flight_Model model) { this.model = model; model.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { int temp; string s = GetPropertyValue(model, e.PropertyName).ToString(); if (Equals(e.PropertyName, "Line") && model.Line != null) { string[] words = s.Split(','); throttle = words[6].Substring(0, Math.Min(words[6].Length, 7)); NotifyPropertyChanged("VM_Throttle"); aileron = words[0].Substring(0, Math.Min(words[0].Length, 7)); NotifyPropertyChanged("VM_Aileron"); elevator = words[1].Substring(0, Math.Min(words[1].Length, 7)); NotifyPropertyChanged("VM_Elevator"); rudder = words[2].Substring(0, Math.Min(words[2].Length, 7)); NotifyPropertyChanged("VM_Rudder"); temp = (int)(70 + float.Parse(aileron) * 70); left = temp.ToString(); NotifyPropertyChanged("VM_Left"); temp = (int)(59 + float.Parse(elevator) * 70); top = temp.ToString(); NotifyPropertyChanged("VM_Top"); } }; }
public detector(Flight_Model model, /*VM_Graph graph,*/ XmlHandler xmlHandler, FileHandler fileHandler) { InitializeComponent(); vm = new VM_Detector(model, /*,graph*/ xmlHandler, fileHandler); DataContext = vm; vm.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { if (Equals(e.PropertyName, "EnableDetect")) { detect.IsEnabled = vm.EnableDetect; } else if (Equals(e.PropertyName, "EnablePrevious")) { previous.IsEnabled = vm.EnablePrevious; } else if (Equals(e.PropertyName, "EnablePlay")) { play.IsEnabled = vm.EnablePlay; } else if (Equals(e.PropertyName, "EnableNext")) { next.IsEnabled = vm.EnableNext; } }; }
public VM_details(Flight_Model model) { this.model = model; model.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { string s = GetPropertyValue(model, e.PropertyName).ToString(); if (Equals(e.PropertyName, "Line") && model.Line != null) { string[] words = s.Split(','); height = words[25].Substring(0, Math.Min(words[25].Length, 7)); NotifyPropertyChanged("VM_Height"); airSpeed = words[21].Substring(0, Math.Min(words[21].Length, 7)); NotifyPropertyChanged("VM_AirSpeed"); // still looking for the correct column in the CSV file for flightDirection, guess heading-deg flightDirection = words[19].Substring(0, Math.Min(words[19].Length, 7)); NotifyPropertyChanged("VM_FlightDirection"); pitch = words[18].Substring(0, Math.Min(words[18].Length, 7)); NotifyPropertyChanged("VM_Pitch"); roll = words[17].Substring(0, Math.Min(words[17].Length, 7)); NotifyPropertyChanged("VM_Roll"); // side-slip int the XML file for yaw yaw = words[20].Substring(0, Math.Min(words[20].Length, 7)); NotifyPropertyChanged("VM_Yaw"); } }; }
//FileHandler fileHandler; public MainWindow(Flight_Model model, XmlHandler xmlHandler, FileHandler fileHandler) { InitializeComponent(); this.model = model; this.xmlHandler = xmlHandler; this.fileHandler = fileHandler; loadedUserControl(); }
public playBar(Flight_Model model) { InitializeComponent(); vm = new VM_PlayBar(model); DataContext = vm; this.speed_val.Text = "1.0"; // ... }
public graph(Flight_Model model, XmlHandler xmlHandler) { InitializeComponent(); vm = new VM_Graph(model, xmlHandler); DataContext = vm; vm.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { if (Equals(e.PropertyName, "IndexCategory")) { indexCategoryChanged(); } }; }
public void start() { FileHandler fileHandler = new FileHandler(CsvFileName); XmlHandler xmlHandler = new XmlHandler(XmlFileName); Flight_Model model = new Flight_Model(); MainWindow mainWindow = new MainWindow(model, xmlHandler, fileHandler); model.File = fileHandler.getFile(); mainWindow.Show(); model.start(); }
public VM_Screen(Flight_Model model) { this.model = model; try { // create a TCPClient object at the localhost on port 5400 this.client = new TcpClient("localhost", 5400); nwStream = client.GetStream(); endl = Encoding.ASCII.GetBytes("\r\n"); model.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { byte[] bytesToSend = ASCIIEncoding.ASCII.GetBytes(GetPropertyValue(model, e.PropertyName).ToString()); nwStream.Write(bytesToSend, 0, bytesToSend.Length); nwStream.Write(endl, 0, endl.Length); }; } catch (Exception e) { } }
public VM_PlayBar(Flight_Model model) { this.model = model; model.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { this.NotifyPropertyChanged("VM_" + e.PropertyName); }; model.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { if (Equals(e.PropertyName, "Step") && (model.Step % 10) == 0) { int currentStep = model.Step / 10; hours = currentStep / 3600; currentStep = currentStep % 3600; minuts = currentStep / 60; currentStep = currentStep % 60; seconds = currentStep; Time = String.Format("{0:D2}", hours) + ":" + String.Format("{0:D2}", minuts) + ":" + String.Format("{0:D2}", seconds); } this.NotifyPropertyChanged("Time"); }; }