/// <summary> /// The MeasurerService calls Process method periodically as defined in plugin's config ExecuteInterval element. The time is seconds. /// Note that the same instance of this class is alive the whole time as the service is alive! So make this process as sleek and lean as possible. /// </summary> public void Process() { //library takes the config and a Logger instance PilotLib pl = new PilotLib(pc, Log); //librarys only public facing method return a MeasurementPackage MeasurementPackage mp = pl.GetMeasurementPackage(); // When your plugin has something to save raise ProcessCompleted event. The Name property can be used as ProcessCompletedEventArgs source parameter. // If at some point your plugin has nothing to save, then don't raise the event. if (mp != null && mp.Measurements != null && mp.Measurements.Count > 0) { //Update and save the configuration files LastMeasurementTime for each file pc.UpdateLastMeasurementTime(pl.NewLastMeasurementTime); PilotConfig.SavePilotConfig(ConfigurationFile.GetPluginRootedPath(), pc); this.OnProcessCompleted(new ProcessCompletedEventArgs(this.Name, mp)); } }
/// <summary> /// The MeasurerService calls LoadConfig method after the properties are set. /// </summary> public void LoadConfig() { //pilotconfig returns itself pc = PilotConfig.GetPilotConfig(ConfigurationFile.GetPluginRootedPath()); }