private void CurrentSQLConnectionStore_EvntConfigChanged(object sender, BoolEventArgs args) { ISQLConnectionSettings oldSettings = currentSQLConnectionStore?.GetPrevious(); ISQLConnectionSettings newSettings = currentSQLConnectionStore?.GetCurrent(); if (!(string.IsNullOrWhiteSpace(newSettings?.Database)) && File.Exists(newSettings?.Database)) { try { dBOperations.EvntInfoMessage -= AddLineAtTextBoxResultShow; } catch { } dBOperations = SQLSelector.SetConnector(newSettings); dBOperations.EvntInfoMessage += new SqlAbstractConnector.Message <TextEventArgs>(AddLineAtTextBoxResultShow); } if (oldSettings == null) { tableStore.Set(SQLSelector.GetTables(newSettings)); } else { if (oldSettings.Name != newSettings.Name && oldSettings.Database != newSettings.Database) { tableStore.Set(SQLSelector.GetTables(newSettings)); } } if (!string.IsNullOrWhiteSpace(newSettings?.Database) && !string.IsNullOrWhiteSpace(newSettings?.Table)) { SetAdminStatusLabelText($"Текущая база: {newSettings?.Database}, таблица: {newSettings?.Table}"); } }
private void CurrentSQLConnectionStore_EvntConfigChanged(object sender, BoolEventArgs args) { ISQLConnectionSettings oldSettings = currentSQLConnectionStore?.GetPrevious(); ISQLConnectionSettings newSettings = currentSQLConnectionStore?.GetCurrent(); if (oldSettings != null) { if (oldSettings.Name == newSettings.Name) { return; } if (oldSettings.Database == newSettings.Database) { return; } } ModelCommonStringStore tables = SQLSelector.GetTables(currentSQLConnectionStore?.GetCurrent()); tableStore.Set(tables); }
private void ChangeDB() { cmbTables.Enabled = false; cmbTables.DataSource = null; cmbTables.Items.Clear(); ISQLConnectionSettings newSettings = MakeFromControls(currentSQLConnectionStore?.GetCurrent(), ""); tbResultShow.AppendLine("New Connection settings:" + Environment.NewLine + newSettings.AsString()); currentSQLConnectionStore.Set(newSettings); tableStore.Set(SQLSelector.GetTables(newSettings)); tbResultShow.AppendLine("таблиц: " + tableStore.ToList().Count); if (tableStore?.ToList()?.Count > 1) { cmbTables.Enabled = true; } tbName.Text = currentSQLConnectionStore?.GetCurrent()?.Name; }