//Constructor public FlightSimVM(FlightSimM model) { this.model = model; this.model.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged("VM_" + e.PropertyName); }; }
public mediaPlayer1VM(FlightSimM model) { this.model = model; model.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged("VM_" + e.PropertyName); }; model.Data.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged("VM_" + e.PropertyName); }; this.time = "00:00"; this.minutes = 0.0; this.seconds = 0.0; }
public static FlightSimM SingleFlightSimM() { if (MFlag) { fsm = new FlightSimM(server, port); MFlag = false; } return(fsm); }
private void useDll() { FlightSimM fsm = Single.SingleFlightSimM(); // creates a new csv like the received one but with the properties in the first row. string noPropTrainCSVPath = fsm.CSVTrainPath; string noPropTestCSVPath = fsm.CsvPath; string csvTrain = "train.csv"; string csvTest = "test.csv"; // adds the first line with properties File.WriteAllText(csvTrain, fsm.ColDataNames[0]); File.WriteAllText(csvTest, fsm.ColDataNames[0]); for (int i = 1; i < fsm.ColDataNames.Count; i++) { File.AppendAllText(csvTrain, "," + fsm.ColDataNames[i]); File.AppendAllText(csvTest, "," + fsm.ColDataNames[i]); } File.AppendAllText(csvTrain, "\n"); File.AppendAllText(csvTest, "\n"); // copying the rest of the file as it is string[] noPropTrainLines = File.ReadAllLines(noPropTrainCSVPath); File.AppendAllLines(csvTrain, noPropTrainLines); // copying the rest of the file as it is string[] noPropTestLines = File.ReadAllLines(noPropTestCSVPath); File.AppendAllLines(csvTest, noPropTestLines); // use the dll function, it creates a file named Anomalies.csv that holds all the // AnomalyReports, each line holds: Timestep,Description. string dllPath = fsm.DLLPath; IntPtr pDll = NativeMethods.LoadLibrary(@dllPath); IntPtr pAddressofFunctionToCall = NativeMethods.GetProcAddress(pDll, "useDetector"); useDetector upload = (useDetector)Marshal.GetDelegateForFunctionPointer( pAddressofFunctionToCall, typeof(useDetector)); int theResult = upload(csvTrain, csvTest); // saves the anomaly reports that in the file Animalies.csv // locally in a list of AnomalyReports string anomaliesPath = "Anomalies.csv"; List <AnomalyReport> anomalyReports = Single.SingleDataModel().AnomalyReports; string[] lines = File.ReadAllLines(anomaliesPath); foreach (string ln in lines) { string[] splitted = ln.Split(','); anomalyReports.Add(new AnomalyReport(splitted[1], long.Parse(splitted[0]))); } }