/// <summary> /// Refreshes the dialog controls' values. /// </summary> /// <param name="useDefaultValues">Controls are set to their default values if <c>true</c>. Current stored values in application settings are used otherwise.</param> private void RefreshControlValues(bool useDefaultValues = false) { var settings = Settings.Default; QueryTimeoutNumericUpDown.Maximum = ConnectionTimeoutNumericUpDown.Maximum; GeometryAsTextFormatType spatialFormat; if (useDefaultValues) { ConnectionTimeoutNumericUpDown.Value = Math.Min(ConnectionTimeoutNumericUpDown.Maximum, MiscUtilities.GetPropertyDefaultValueByName <uint>(settings, "GlobalConnectionConnectionTimeout")); QueryTimeoutNumericUpDown.Value = MiscUtilities.GetPropertyDefaultValueByName <uint>(settings, "GlobalConnectionCommandTimeout"); UseOptimisticUpdatesCheckBox.Checked = MiscUtilities.GetPropertyDefaultValueByName <bool>(settings, "EditUseOptimisticUpdate"); PreviewSqlQueriesRadioButton.Checked = MiscUtilities.GetPropertyDefaultValueByName <bool>(settings, "GlobalSqlQueriesPreviewQueries"); ShowExecutedSqlQueryRadioButton.Checked = MiscUtilities.GetPropertyDefaultValueByName <bool>(settings, "GlobalSqlQueriesShowQueriesWithResults"); RestoreSavedEditSessionsCheckBox.Checked = MiscUtilities.GetPropertyDefaultValueByName <bool>(settings, "EditSessionsRestoreWhenOpeningWorkbook"); ReuseWorksheetsRadioButton.Checked = MiscUtilities.GetPropertyDefaultValueByName <bool>(settings, "EditSessionsReuseWorksheets"); PreviewTableDataCheckBox.Checked = MiscUtilities.GetPropertyDefaultValueByName <bool>(settings, "EditPreviewMySqlData"); OpeningWorkbookRadioButton.Checked = MiscUtilities.GetPropertyDefaultValueByName <bool>(settings, "GlobalImportDataRestoreWhenOpeningWorkbook"); SpatialTextFormatComboBox.SelectedValue = Enum.TryParse(MiscUtilities.GetPropertyDefaultValueByName <string>(settings, "GlobalSpatialDataAsTextFormat"), out spatialFormat) ? spatialFormat : GeometryAsTextFormatType.None; ToleranceForFloatAndDoubleTextBox.Text = MiscUtilities.GetPropertyDefaultValueByName <decimal>(settings, "GlobalEditToleranceForFloatAndDouble").ToString(CultureInfo.CurrentCulture); } else { ConnectionTimeoutNumericUpDown.Value = Math.Min(ConnectionTimeoutNumericUpDown.Maximum, settings.GlobalConnectionConnectionTimeout); QueryTimeoutNumericUpDown.Value = settings.GlobalConnectionCommandTimeout; UseOptimisticUpdatesCheckBox.Checked = settings.EditUseOptimisticUpdate; PreviewSqlQueriesRadioButton.Checked = settings.GlobalSqlQueriesPreviewQueries; ShowExecutedSqlQueryRadioButton.Checked = settings.GlobalSqlQueriesShowQueriesWithResults; RestoreSavedEditSessionsCheckBox.Checked = settings.EditSessionsRestoreWhenOpeningWorkbook; ReuseWorksheetsRadioButton.Checked = settings.EditSessionsReuseWorksheets; PreviewTableDataCheckBox.Checked = settings.EditPreviewMySqlData; OpeningWorkbookRadioButton.Checked = settings.GlobalImportDataRestoreWhenOpeningWorkbook; SpatialTextFormatComboBox.SelectedValue = Enum.TryParse(settings.GlobalSpatialDataAsTextFormat, out spatialFormat) ? spatialFormat : GeometryAsTextFormatType.None; ToleranceForFloatAndDoubleTextBox.Text = settings.GlobalEditToleranceForFloatAndDouble.ToString(CultureInfo.CurrentCulture); } NoSqlStatementsRadioButton.Checked = !PreviewSqlQueriesRadioButton.Checked && !ShowExecutedSqlQueryRadioButton.Checked; CreateNewWorksheetsRadioButton.Checked = !ReuseWorksheetsRadioButton.Checked; ShowingSidebarRadioButton.Checked = !OpeningWorkbookRadioButton.Checked; _manageConnectionInfosDialog?.RefreshControlValues(useDefaultValues); }