public DataInfoVM(FlightDetectorModel fdMoodel) { this.fdm = fdMoodel; this.fdm.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged("VM_" + e.PropertyName); }; }
//c'tor public GraphVM(FlightDetectorModel fdm) { this.fdm = fdm; this.prevLineIndex = 0; AnomaliesPoints = new List <List <DataPoint> >(); for (int i = 0; i < 42; i++) { AnomaliesPoints.Add(new List <DataPoint>()); } AnomaliesPointsSpecificFeature = new List <DataPoint>(); this.fdm.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { //if the propreties have changed if (e.PropertyName == "PropertyNames") { PropertyIndexes = new List <PropertyIndex>(); int counter = 0; //pass on each proprety name and create propertyIndex according to it's index and name foreach (var item in this.fdm.PropertyNames) { PropertyIndex propertyIndex = new PropertyIndex(); propertyIndex.Name = item; propertyIndex.Id = counter++; PropertyIndexes.Add(propertyIndex); } } //if the values have changed if (e.PropertyName == "AnomalyPropertyValues") { List <float> valuesGraph = fdm.AnomalyPropertyValues[0]; Points = new List <DataPoint>(); DateTime date = new DateTime(2020, 3, 26, 0, 0, 0); //create data points aacording to the time and value foreach (var item in valuesGraph) { Points.Add(new DataPoint(DateTimeAxis.ToDouble(date), item)); date = date.AddMinutes(1); } List <float> correlatedPropretyGraph = fdm.AnomalyPropertyValues[0]; CorrelatedPoints = new List <DataPoint>(); foreach (var item in correlatedPropretyGraph) { CorrelatedPoints.Add(new DataPoint(DateTimeAxis.ToDouble(date), item)); date = date.AddMinutes(1); } List <float> regLinePropretyGraph = fdm.AnomalyPropertyValues[0]; RegPoints = new List <DataPoint>(); for (int i = 0; i < correlatedPropretyGraph.Count; i++) { RegPoints.Add(new DataPoint(valuesGraph[i], correlatedPropretyGraph[i])); date = date.AddMinutes(1); } RegLinePoints = new List <DataPoint>(); } //if the values have changed if (e.PropertyName == "LineToTransmit") { //update the values proprety that is chosen at the list box this.currenLineIndex = fdm.LineToTransmit; if (pressed) { INotifyPropertyChanged("UpdateGraph"); } } if (e.PropertyName == "AnomaliesList") { //update the anomalies updateAnomaliesPoints(); } if (e.PropertyName == "CorrlativeCircles") { //update the cireles if (pressed) { this.drawCircle = true; updateCircels(); INotifyPropertyChanged("UpdateCircele"); } } }; this.fdm.readXml(); this.fdm.readAnomalyCsv(); this.fdm.readNormalCsv(); this.mcf = new MostCorrelativeFinder(fdm.NormalPropertyValues); this.minCorrelatedPointsXValue = new List <float>(); this.maxCorrelatedPointsXValue = new List <float>(); //List<int> cor = mcf.CorrlatedColumns; //printCor(cor); updateMinMaxValues(); // updateAnomaliesPoints(); }