/// <summary>Store the configuration, i.e. write a specific configuration file. /// </summary> public void StoreConfiguration() { ExcelLogger.SetAddOnDataAdviceFails(cBoxAddLogfileOnDropdownListFails.Checked); ExcelLogger.SetPopupGlobalLogfileBoxOnError(cBoxPopupGlobalLogfileForm.Checked); var userGlobalLoggingLevel = comboBoxGlobalLoggingLevel.SelectedItem as EnumString <ExcelPoolLoggingLevel>; if (userGlobalLoggingLevel != null) { ExcelPool.StoreLoggingLevel(userGlobalLoggingLevel.Value); } else { ExcelPool.StoreLoggingLevel(ExcelPoolLoggingLevel.None); } var outputUsage = comboBoxLocalOutputUsage.SelectedItem as EnumString <ExcelLogger.OutputUsage>; if (outputUsage != null) { ExcelObjectLogger.SetOutputUsage(outputUsage.Value); } else { ExcelObjectLogger.SetOutputUsage(ExcelLogger.OutputUsage.None); } ExcelObjectLogger.SetOutputFolder(editLocalOutputFolder.Text); ExcelAddIn.Configuration.Save(); m_ConfigurationChanged = false; }
/// <summary>Restores the configuration, i.e. reads the original configuration from some configuration file or take some default values and show these configuration. /// </summary> public void RestoreConfiguration() { cBoxAddLogfileOnDropdownListFails.Checked = ExcelLogger.GetAddOnDataAdviceFails(); cBoxPopupGlobalLogfileForm.Checked = ExcelLogger.GetPopupGlobalLogfileBoxOnError(); var restoredLoggingLevel = ExcelPool.GetLoggingLevelFromConfigFile(); foreach (var item in comboBoxGlobalLoggingLevel.Items) { var itemValue = item as EnumString <ExcelPoolLoggingLevel>; if ((itemValue != null) && (itemValue.Value == restoredLoggingLevel)) { comboBoxGlobalLoggingLevel.SelectedItem = item; break; } } var outputUsage = ExcelObjectLogger.GetOutputUsage(); foreach (var item in comboBoxLocalOutputUsage.Items) { var itemValue = item as EnumString <ExcelLogger.OutputUsage>; if ((itemValue != null) && (itemValue.Value == outputUsage)) { comboBoxLocalOutputUsage.SelectedItem = item; break; } } editLocalOutputFolder.Text = ExcelObjectLogger.GetOutputFolder(); m_ConfigurationChanged = false; }