/// <summary>
        /// Event delegate method fired when the <see cref="ImportAdvancedOptionsDialog"/> is being closed.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">Event arguments.</param>
        private void GlobalOptionsDialog_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (DialogResult == DialogResult.Cancel)
            {
                return;
            }

            var settings = Settings.Default;

            DeleteConnectionInfos();
            settings.GlobalConnectionConnectionTimeout      = (uint)ConnectionTimeoutNumericUpDown.Value;
            settings.GlobalConnectionCommandTimeout         = (uint)QueryTimeoutNumericUpDown.Value;
            settings.EditUseOptimisticUpdate                = UseOptimisticUpdatesCheckBox.Checked;
            settings.GlobalSqlQueriesPreviewQueries         = PreviewSqlQueriesRadioButton.Checked;
            settings.GlobalSqlQueriesShowQueriesWithResults = ShowExecutedSqlQueryRadioButton.Checked;
            settings.EditPreviewMySqlData = PreviewTableDataCheckBox.Checked;
            settings.EditSessionsRestoreWhenOpeningWorkbook = RestoreSavedEditSessionsCheckBox.Checked;
            settings.EditSessionsReuseWorksheets            = ReuseWorksheetsRadioButton.Checked;
            if (_manageConnectionInfosDialog != null)
            {
                settings.ConnectionInfosLastAccessDays = _manageConnectionInfosDialog.ConnectionInfosLastAccessDays;
                settings.DeleteAutomaticallyOrphanedConnectionInfos = _manageConnectionInfosDialog.DeleteAutomaticallyOrphanedConnectionInfos;
            }

            MiscUtilities.SaveSettings();
        }
Beispiel #2
0
        /// <summary>
        /// Event delegate method fired when the <see cref="ImportAdvancedOptionsDialog"/> is being closed.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">Event arguments.</param>
        private void ImportAdvancedOptionsDialog_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (DialogResult == DialogResult.Cancel)
            {
                return;
            }

            var previewRowsQuantity = (int)PreviewRowsQuantityNumericUpDown.Value;

            ParentFormRequiresDataReload         = Settings.Default.ImportPreviewRowsQuantity != previewRowsQuantity;
            ParentFormRequiresLimitRecalculation = Settings.Default.ImportCreateExcelTable != CreateExcelTableCheckbox.Checked;

            Settings.Default.ImportPreviewRowsQuantity     = previewRowsQuantity;
            Settings.Default.ImportEscapeFormulaTextValues = EscapeFormulaValuesCheckBox.Checked;
            Settings.Default.ImportCreateExcelTable        = CreateExcelTableCheckbox.Checked;
            Settings.Default.ImportExcelTableStyleName     = UseStyleComboBox.Text;
            Settings.Default.ImportPrefixExcelTable        = PrefixExcelTablesCheckBox.Checked;
            Settings.Default.ImportPrefixExcelTableText    = PrefixExcelTablesTextBox.Text;
            Settings.Default.ImportExcelFormatLongDates    = string.IsNullOrWhiteSpace(FormatLongDatesTextBox.Text)
        ? ExcelUtilities.DATETIME_FORMAT
        : FormatLongDatesTextBox.Text;
            Settings.Default.ImportExcelFormatShortDates = string.IsNullOrWhiteSpace(FormatShortDatesTextBox.Text)
        ? ExcelUtilities.DATE_FORMAT
        : FormatShortDatesTextBox.Text;
            Settings.Default.ImportExcelFormatTime = string.IsNullOrWhiteSpace(FormatTimeTextBox.Text)
        ? ExcelUtilities.TIME_FORMAT
        : FormatTimeTextBox.Text;
            Settings.Default.ImportFloatingPointDataAsDecimal = FloatingPointDataAsDecimalCheckBox.Checked;
            MiscUtilities.SaveSettings();
        }
Beispiel #3
0
        /// <summary>
        /// Event delegate method fired when the <see cref="ImportAdvancedOptionsDialog"/> is being closed.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">Event arguments.</param>
        private void AppendAdvancedOptionsDialog_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (DialogResult == DialogResult.Cancel)
            {
                return;
            }

            var previewRowsQuantity = (int)PreviewRowsQuantityNumericUpDown.Value;

            LimitPreviewRowsQuantityChanged                        = Settings.Default.AppendLimitPreviewRowsQuantity != previewRowsQuantity;
            ShowDataTypesChanged                                   = Settings.Default.AppendShowDataTypes != ShowDataTypesCheckBox.Checked;
            UseFormattedValuesChanged                              = Settings.Default.AppendUseFormattedValues != UseFormattedValuesCheckBox.Checked;
            Settings.Default.AppendPerformAutoMap                  = DoNotPerformAutoMapCheckBox.Checked;
            Settings.Default.AppendAutoStoreColumnMapping          = AutoStoreColumnMappingCheckBox.Checked;
            Settings.Default.AppendReloadColumnMapping             = ReloadColumnMappingCheckBox.Checked;
            Settings.Default.AppendConfirmColumnMappingOverwriting = ConfirmMappingOverwritingCheckBox.Checked;
            Settings.Default.AppendUseFormattedValues              = UseFormattedValuesCheckBox.Checked;
            Settings.Default.AppendShowDataTypes                   = ShowDataTypesCheckBox.Checked;
            Settings.Default.AppendLimitPreviewRowsQuantity        = previewRowsQuantity;
            Settings.Default.AppendSqlQueriesDisableIndexes        = DisableTableIndexesCheckBox.Checked;
            Settings.Default.AppendDuplicateUniqueValuesAction     = ErrorAndAbortRadioButton.Checked
        ? MySqlDataTable.AppendDuplicateValuesActionType.ErrorOutAndAbort.ToString()
        : (IgnoreDuplicatesRadioButton.Checked
          ? MySqlDataTable.AppendDuplicateValuesActionType.IgnoreDuplicates.ToString()
          : MySqlDataTable.AppendDuplicateValuesActionType.ReplaceDuplicates.ToString());
            Settings.Default.AppendGenerateMultipleInserts = GenerateMultipleInsertsCheckBox.Checked;
            Settings.Default.StoredDataMappings            = Mappings;
            MiscUtilities.SaveSettings();
        }
        /// <summary>
        /// Event delegate method fired when the <see cref="ImportAdvancedOptionsDialog"/> is being closed.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">Event arguments.</param>
        private void ExportAdvancedOptionsDialog_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (DialogResult == DialogResult.Cancel)
            {
                return;
            }

            Settings.Default.ExportLimitPreviewRowsQuantity      = (int)PreviewRowsQuantityNumericUpDown.Value;
            Settings.Default.ExportDetectDatatype                = DetectDatatypeCheckBox.Checked;
            Settings.Default.ExportAddBufferToVarchar            = AddBufferToVarCharCheckBox.Checked;
            Settings.Default.ExportAutoIndexIntColumns           = AutoIndexIntColumnsCheckBox.Checked;
            Settings.Default.ExportAutoAllowEmptyNonIndexColumns = AutoAllowEmptyNonIndexColumnsCheckBox.Checked;
            Settings.Default.ExportShowAllMySqlDataTypes         = ShowAllDataTypesCheckBox.Checked;
            Settings.Default.ExportUseFormattedValues            = UseFormattedValuesCheckBox.Checked;
            Settings.Default.ExportSqlQueriesCreateIndexesLast   = CreateTableIndexesLastCheckBox.Checked;
            Settings.Default.ExportGenerateMultipleInserts       = GenerateMultipleInsertsCheckBox.Checked;
            MiscUtilities.SaveSettings();
        }
        /// <summary>
        /// Sets the appearance of <see cref="MySqlListViewNode"/> objects appearing in the <see cref="SchemasList"/>.
        /// </summary>
        /// <param name="refreshSchemasList">Flag indicating whether the <see cref="SchemasList"/> must be refreshed after resetting the appearance.</param>
        private void SetItemsAppearance(bool refreshSchemasList)
        {
            var displayCollations = DisplaySchemaCollationsToolStripMenuItem.Checked;

            if (Settings.Default.SchemasDisplayCollations != displayCollations)
            {
                Settings.Default.SchemasDisplayCollations = displayCollations;
                MiscUtilities.SaveSettings();
            }

            SchemasList.ClearHeaderNodes();
            SchemasList.SetItemsAppearance(displayCollations, false);
            SchemasList.AddHeaderNode("Schemas");
            SchemasList.AddHeaderNode("System Schemas");
            if (refreshSchemasList)
            {
                RefreshSchemasToolStripMenuItem_Click(null, EventArgs.Empty);
            }
        }
        /// <summary>
        /// Sets the value of the global optimistic update for all sessions property and updates the context menu options accordingly.
        /// </summary>
        /// <param name="value">The new value of the property.</param>
        /// <param name="saveInSettings">Flag indicating whether the new value must be saved in the settings file.</param>
        private void SetUseOptimisticUpdateForAllSessions(bool value, bool saveInSettings)
        {
            _updatingUSeOptimisticUpdateSetting = true;
            if (saveInSettings)
            {
                Settings.Default.EditUseOptimisticUpdate = value;
                MiscUtilities.SaveSettings();
            }

            ForAllSessionsToolStripMenuItem.Checked = value;
            if (value)
            {
                _useOptimisticUpdateForThisSession           = true;
                ForThisSessionToolStripMenuItem.Checked      = true;
                UseOptimisticUpdateToolStripMenuItem.Checked = true;
            }

            _updatingUSeOptimisticUpdateSetting = false;
        }
        /// <summary>
        /// Event delegate method fired when the <see cref="ImportAdvancedOptionsDialog"/> is being closed.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">Event arguments.</param>
        private void AppendAdvancedOptionsDialog_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (DialogResult == DialogResult.Cancel)
            {
                return;
            }

            var previewRowsQuantity = (int)PreviewRowsQuantityNumericUpDown.Value;

            LimitPreviewRowsQuantityChanged                        = Settings.Default.AppendLimitPreviewRowsQuantity != previewRowsQuantity;
            ShowDataTypesChanged                                   = Settings.Default.AppendShowDataTypes != ShowDataTypesCheckBox.Checked;
            UseFormattedValuesChanged                              = Settings.Default.AppendUseFormattedValues != UseFormattedValuesCheckBox.Checked;
            Settings.Default.AppendPerformAutoMap                  = DoNotPerformAutoMapCheckBox.Checked;
            Settings.Default.AppendAutoStoreColumnMapping          = AutoStoreColumnMappingCheckBox.Checked;
            Settings.Default.AppendReloadColumnMapping             = ReloadColumnMappingCheckBox.Checked;
            Settings.Default.AppendConfirmColumnMappingOverwriting = ConfirmMappingOverwritingCheckBox.Checked;
            Settings.Default.AppendUseFormattedValues              = UseFormattedValuesCheckBox.Checked;
            Settings.Default.AppendShowDataTypes                   = ShowDataTypesCheckBox.Checked;
            Settings.Default.AppendLimitPreviewRowsQuantity        = previewRowsQuantity;
            Settings.Default.AppendSqlQueriesDisableIndexes        = DisableTableIndexesCheckBox.Checked;
            Settings.Default.AppendGenerateMultipleInserts         = GenerateMultipleInsertsCheckBox.Checked;
            Settings.Default.StoredDataMappings                    = Mappings;
            MiscUtilities.SaveSettings();
        }