/// <summary> /// Obtain configuration from a file. If the file name is not supplied the the default /// path of Constants.Data_DIR\eddpmonitor.json is used /// </summary> public static EddpConfiguration FromFile(string filename = null) { if (filename == null) { filename = Constants.DATA_DIR + @"\eddpmonitor.json"; } EddpConfiguration configuration = new EddpConfiguration(); try { configuration = JsonConvert.DeserializeObject <EddpConfiguration>(File.ReadAllText(filename)); } catch (Exception ex) { Logging.Debug("Failed to read EDDP monitor configuration", ex); } if (configuration == null) { configuration = new EddpConfiguration(); } configuration.path = filename; return(configuration); }
private void configurationFromFile() { configuration = EddpConfiguration.FromFile(); ObservableCollection <Watch> watches = new ObservableCollection <Watch>(); foreach (Watch watch in configuration.watches) { watches.Add(watch); } Watches = watches; }
public void Reload() { // Reload the configuration and let the monitor know that we have done so configuration = EddpConfiguration.FromFile(); reloading = true; }
/// <summary> /// This method is run when the monitor is requested to start /// </summary> public void Start() { configuration = EddpConfiguration.FromFile(); running = true; monitor(); }