コード例 #1
0
 /// <summary>
 /// Creates a new InputConfig object and populates it for use
 /// </summary>
 /// <returns>A populated InputConfig object that reflects the settings configured in the UI by the user.</returns>
 private IOConfig.InputConfig CreateConfigObject()
 {
     IOConfig.InputConfig cfg = new IOConfig.InputConfig();
     cfg.Settings = ReadControlsToSettings();
     cfg.Inputs = SampleRegionList();
     cfg.Name = "Quick and not accurate";
     return cfg;
 }
コード例 #2
0
 /// <summary>
 /// Loads a selected config object in as the current active configuration.
 /// </summary>
 private void LoadConfig()
 {
     if (lstConfigs.SelectedIndex == -1)
     {
         MessageBox.Show(Properties.Resources.MAIN_NO_ITEM_SELECTED);
     }
     else
     {
         ListBoxItem _selected = (ListBoxItem)lstConfigs.SelectedItem;
         _currentioconfig = _plugins.Find(i => i.Name == _selected.Content.ToString());
         ReadSettingsToControls(_currentioconfig.Settings);
     }
 }
コード例 #3
0
        /// <summary>
        /// Loads up Default.hue as current configuration. Also recreates the file if it does not exist.
        /// </summary>
        private void LoadDefaultSettings()
        {
            Tools tools = new Tools();

            try
            {
                _currentioconfig = tools.ImportConfig<IOConfig.InputConfig>(AppDomain.CurrentDomain.BaseDirectory + "Plugins\\IO\\Default.hue");
                ReadSettingsToControls(_currentioconfig.Settings);
            }
            catch (Exception ex) when (ex is FileNotFoundException)
            {
                tools.CreateDefaultHueFile();
                _currentioconfig = tools.ImportConfig<IOConfig.InputConfig>(AppDomain.CurrentDomain.BaseDirectory + "Plugins\\IO\\Default.hue");
                ReadSettingsToControls(_currentioconfig.Settings);
                return;
            }

            catch (Exception)
            {
                throw;
            }
        }