public void CreatePluginSettingsTemplate() { PluginSettings ps = new PluginSettings() { MinimumExecutionInterval = 10, Plugins = new List <MeasurerProcessPlugin>() }; MeasurerProcessPlugin mpp = new MeasurerProcessPlugin() { ConfigFile = "config_file_path", Description = "description of plugin", Enabled = true, ExecuteInterval = 20, ExecuteOnServiceStart = false, Name = "plugin name", PluginAssembly = "plugin_dll_path" }; ps.Plugins.Add(mpp); mpp = new MeasurerProcessPlugin() { ConfigFile = "config_file_path_2", Description = "description of 2nd plugin", Enabled = true, ExecuteInterval = 110, ExecuteOnServiceStart = false, Name = "plugin 2 name", PluginAssembly = "plugin2_dll_path" }; ps.Plugins.Add(mpp); string xml = SerializeHelper.SerializeToString <PluginSettings>(ps); Trace.WriteLine(xml); Assert.IsNotNull(xml); PluginSettings dps = SerializeHelper.Deserialize <PluginSettings>(xml); Assert.IsNotNull(dps); Assert.AreEqual(dps.MinimumExecutionInterval, ps.MinimumExecutionInterval); Assert.AreEqual(dps.Plugins.Count, ps.Plugins.Count); }
private void CreateTimer(MeasurerProcessPlugin mpp, IMeasurer im) { System.Timers.Timer timer; timer = new System.Timers.Timer(); timer.AutoReset = true; if (mpp.ExecuteInterval > this.settings.MinimumExecutionInterval) { timer.Interval = (double)mpp.ExecuteInterval.SecondsToMilliseconds(); } else { timer.Interval = (double)this.settings.MinimumExecutionInterval.SecondsToMilliseconds(); } timer.Elapsed += timer_Elapsed; this.timers.Add(timer, im); }