public LineChart_model() { secondsTocalc = 30; fc = FlightController.GetInstance; mc = MediaController.GetInstance; fc.PropertyChanged += UpdateMedia; // Names = fc.Names; //Names = new string[] { "aileron", "elevator", "rudder", "flaps", "slats", "speed_brake", // "engine1_throttle", "engine2_throttle", "engine1_pump", "engine2_pump", "electric1_pump", // "electric2_pump", "external_power", "apu_generator", "latitude_deg", "longitude_deg", "altitude_ft", // "roll_deg", "pitch_deg", "heading_deg", "side_slip_deg", "airspeed_kt", "glideslop", "vertical_speed_fps", // "airspeed_indicator_indicated_speed_kt", "altimeter_indicated-altitude-ft", "altimeter_pressure-alt-ft", // "attitude-indicator_indicated-pitch-deg", "attitude-indicator_indicated-roll-deg", // "attitude-indicator_internal-pitch-deg", "attitude-indicator_internal-roll-deg", "encoder_indicated-altitude-ft", // "encoder_pressure-alt-ft", "gps_indicated-altitude-ft", "gps_indicated-ground-speed-kt", "gps_indicated-vertical-speed", // "indicated-heading-deg", "magnetic-compass_indicated-heading-deg", "slip-skid-ball_indicated-slip-skid", "turn-indicator_indicated-turn-rate", // "vertical-speed-indicator_indicated-speed-fpm", "engine_rpm" }; //need to store this globally or get dynamically from XML // this.NotifyPropertyChanged("names"); datalists = new Dictionary <string, LinkedList <DataPoint> >(); fc.dataUpdated += Update; mc.PropertyChanged += UpdateMedia; //for(int i = 0; i < names.Length; i++) //{ // datalists.Add(names[i], new LinkedList<DataPoint>()); //} timeStamp = 0; dc = null; }
public void loadCSV(string csv, string[] names) { this.csv_file = csv; Names = names; NotifyPropertyChanged("Names"); parser = new FlightDataParser(csv, names); media.numberOfLines = parser.GetNumberOfLines(); media.PropertyChanged += play; dc = new DataCalculations(parser); }
private void Update(object sender, FlightControllerEventArgs e) { if (dc == null) { dc = fc.getDataCalculations; } for (int i = 0; i < Names.Length; i++) { datalists[Names[i]].AddLast(new DataPoint(mc.getCurrentTimeInMilisecs(), float.Parse(e.GetData(Names[i])))); } NotifyPropertyChanged("list"); //NotifyPropertyChanged("CorralatedList"); // NotifyPropertyChanged("CorralatedName"); timeStamp++; }