public Appearance(LogFontSize fontSize, string fontFamily, ColoringMode coloring, PaletteBrightness coloringBrightness) { this.FontSize = fontSize; this.FontFamily = fontFamily; this.Coloring = coloring; this.ColoringBrightness = coloringBrightness; }
private void btnSave_Click(object sender, EventArgs e) { var configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); if (configuration.AppSettings.Settings[ConfigurationParameters.LogFontSize] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.LogFontSize, LogFontSize.ToString(CultureInfo.InvariantCulture)); } else { configuration.AppSettings.Settings[ConfigurationParameters.LogFontSize].Value = LogFontSize.ToString(CultureInfo.InvariantCulture); } if (configuration.AppSettings.Settings[ConfigurationParameters.TreeViewFontSize] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.TreeViewFontSize, TreeViewFontSize.ToString(CultureInfo.InvariantCulture)); } else { configuration.AppSettings.Settings[ConfigurationParameters.TreeViewFontSize].Value = TreeViewFontSize.ToString(CultureInfo.InvariantCulture); } if (configuration.AppSettings.Settings[ConfigurationParameters.ShowMessageCountParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.ShowMessageCountParameter, ShowMessageCount.ToString()); } else { configuration.AppSettings.Settings[ConfigurationParameters.ShowMessageCountParameter].Value = ShowMessageCount.ToString(); } if (configuration.AppSettings.Settings[ConfigurationParameters.SaveMessageToFileParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.SaveMessageToFileParameter, SaveMessageToFile.ToString()); } else { configuration.AppSettings.Settings[ConfigurationParameters.SaveMessageToFileParameter].Value = SaveMessageToFile.ToString(); } if (configuration.AppSettings.Settings[ConfigurationParameters.UseAsciiParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.UseAsciiParameter, UseAscii.ToString()); } else { configuration.AppSettings.Settings[ConfigurationParameters.UseAsciiParameter].Value = UseAscii.ToString(); } if (configuration.AppSettings.Settings[ConfigurationParameters.SavePropertiesToFileParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.SavePropertiesToFileParameter, SavePropertiesToFile.ToString()); } else { configuration.AppSettings.Settings[ConfigurationParameters.SavePropertiesToFileParameter].Value = SavePropertiesToFile.ToString(); } if (configuration.AppSettings.Settings[ConfigurationParameters.SaveCheckpointsToFileParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.SaveCheckpointsToFileParameter, SaveCheckpointsToFile.ToString()); } else { configuration.AppSettings.Settings[ConfigurationParameters.SaveCheckpointsToFileParameter].Value = SaveCheckpointsToFile.ToString(); } if (configuration.AppSettings.Settings[ConfigurationParameters.RetryCountParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.RetryCountParameter, RetryCount.ToString(CultureInfo.InvariantCulture)); } else { configuration.AppSettings.Settings[ConfigurationParameters.RetryCountParameter].Value = RetryCount.ToString(CultureInfo.InvariantCulture); } if (configuration.AppSettings.Settings[ConfigurationParameters.RetryTimeoutParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.RetryTimeoutParameter, RetryTimeout.ToString(CultureInfo.InvariantCulture)); } else { configuration.AppSettings.Settings[ConfigurationParameters.RetryTimeoutParameter].Value = RetryTimeout.ToString(CultureInfo.InvariantCulture); } if (configuration.AppSettings.Settings[ConfigurationParameters.TopParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.TopParameter, TopCount.ToString(CultureInfo.InvariantCulture)); } else { configuration.AppSettings.Settings[ConfigurationParameters.TopParameter].Value = TopCount.ToString(CultureInfo.InvariantCulture); } if (configuration.AppSettings.Settings[ConfigurationParameters.ReceiveTimeoutParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.ReceiveTimeoutParameter, ReceiveTimeout.ToString(CultureInfo.InvariantCulture)); } else { configuration.AppSettings.Settings[ConfigurationParameters.ReceiveTimeoutParameter].Value = ReceiveTimeout.ToString(CultureInfo.InvariantCulture); } if (configuration.AppSettings.Settings[ConfigurationParameters.ServerTimeoutParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.ServerTimeoutParameter, ServerTimeout.ToString(CultureInfo.InvariantCulture)); } else { configuration.AppSettings.Settings[ConfigurationParameters.ServerTimeoutParameter].Value = ServerTimeout.ToString(CultureInfo.InvariantCulture); } if (configuration.AppSettings.Settings[ConfigurationParameters.SenderThinkTimeParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.SenderThinkTimeParameter, SenderThinkTime.ToString(CultureInfo.InvariantCulture)); } else { configuration.AppSettings.Settings[ConfigurationParameters.SenderThinkTimeParameter].Value = SenderThinkTime.ToString(CultureInfo.InvariantCulture); } if (configuration.AppSettings.Settings[ConfigurationParameters.SenderThinkTimeParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.SenderThinkTimeParameter, SenderThinkTime.ToString(CultureInfo.InvariantCulture)); } else { configuration.AppSettings.Settings[ConfigurationParameters.SenderThinkTimeParameter].Value = SenderThinkTime.ToString(CultureInfo.InvariantCulture); } if (configuration.AppSettings.Settings[ConfigurationParameters.ReceiverThinkTimeParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.ReceiverThinkTimeParameter, ReceiverThinkTime.ToString(CultureInfo.InvariantCulture)); } else { configuration.AppSettings.Settings[ConfigurationParameters.ReceiverThinkTimeParameter].Value = ReceiverThinkTime.ToString(CultureInfo.InvariantCulture); } if (configuration.AppSettings.Settings[ConfigurationParameters.MonitorRefreshIntervalParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.MonitorRefreshIntervalParameter, MonitorRefreshInterval.ToString(CultureInfo.InvariantCulture)); } else { configuration.AppSettings.Settings[ConfigurationParameters.MonitorRefreshIntervalParameter].Value = MonitorRefreshInterval.ToString(CultureInfo.InvariantCulture); } if (configuration.AppSettings.Settings[ConfigurationParameters.PrefetchCountParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.PrefetchCountParameter, PrefetchCount.ToString(CultureInfo.InvariantCulture)); } else { configuration.AppSettings.Settings[ConfigurationParameters.PrefetchCountParameter].Value = PrefetchCount.ToString(CultureInfo.InvariantCulture); } if (configuration.AppSettings.Settings[ConfigurationParameters.SubscriptionIdParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.SubscriptionIdParameter, SubscriptionId); } else { configuration.AppSettings.Settings[ConfigurationParameters.SubscriptionIdParameter].Value = SubscriptionId; } if (configuration.AppSettings.Settings[ConfigurationParameters.CertificateThumbprintParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.CertificateThumbprintParameter, CertificateThumbprint); } else { configuration.AppSettings.Settings[ConfigurationParameters.CertificateThumbprintParameter].Value = CertificateThumbprint; } if (configuration.AppSettings.Settings[ConfigurationParameters.LabelParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.LabelParameter, Label); } else { configuration.AppSettings.Settings[ConfigurationParameters.LabelParameter].Value = Label; } if (configuration.AppSettings.Settings[ConfigurationParameters.FileParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.FileParameter, MessageFile); } else { configuration.AppSettings.Settings[ConfigurationParameters.FileParameter].Value = MessageFile; } if (configuration.AppSettings.Settings[ConfigurationParameters.MessageParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.MessageParameter, MessageText); } else { configuration.AppSettings.Settings[ConfigurationParameters.MessageParameter].Value = MessageText; } if (configuration.AppSettings.Settings[ConfigurationParameters.ConnectivityMode] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.ConnectivityMode, ServiceBusHelper.ConnectivityMode.ToString()); } else { configuration.AppSettings.Settings[ConfigurationParameters.ConnectivityMode].Value = ServiceBusHelper.ConnectivityMode.ToString(); } if (configuration.AppSettings.Settings[ConfigurationParameters.Encoding] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.Encoding, ServiceBusHelper.EncodingType.ToString()); } else { configuration.AppSettings.Settings[ConfigurationParameters.Encoding].Value = ServiceBusHelper.EncodingType.ToString(); } if (configuration.AppSettings.Settings[ConfigurationParameters.SelectedEntitiesParameter] == null) { configuration.AppSettings.Settings.Add(ConfigurationParameters.SelectedEntitiesParameter, cboSelectedEntities.Text); } else { configuration.AppSettings.Settings[ConfigurationParameters.SelectedEntitiesParameter].Value = cboSelectedEntities.Text; } configuration.Save(ConfigurationSaveMode.Minimal); }