/// <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);
        }
Пример #2
0
        private void configurationFromFile()
        {
            configuration = EddpConfiguration.FromFile();
            ObservableCollection <Watch> watches = new ObservableCollection <Watch>();

            foreach (Watch watch in configuration.watches)
            {
                watches.Add(watch);
            }
            Watches = watches;
        }
Пример #3
0
 public void Reload()
 {
     // Reload the configuration and let the monitor know that we have done so
     configuration = EddpConfiguration.FromFile();
     reloading     = true;
 }
Пример #4
0
 /// <summary>
 /// This method is run when the monitor is requested to start
 /// </summary>
 public void Start()
 {
     configuration = EddpConfiguration.FromFile();
     running       = true;
     monitor();
 }