コード例 #1
0
ファイル: MainBox.cs プロジェクト: itoop2019/SQLIndexManager
 private void ShowDatabaseBox() {
   using (DatabaseBox form = new DatabaseBox()) {
     DialogResult dr = form.ShowDialog(this);
     if (dr == DialogResult.OK) {
       Settings.ActiveHost.Databases = form.GetDatabases();
       RefreshIndexes();
     }
     else {
       labelDatabase.Caption = Settings.ActiveHost.Databases.Count.ToString();
     }
   }
 }
コード例 #2
0
        private void ShowDatabaseBox(bool isConnectionChanged)
        {
            using (DatabaseBox form = new DatabaseBox()) {
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    List <string> dbs = form.GetDatabases();
                    bool          isDatabaseSelectionEqual = Settings.ActiveHost.Databases.OrderBy(t => t).SequenceEqual(dbs.OrderBy(t => t));

                    Settings.ActiveHost.Databases = dbs;

                    if (Settings.Options.ShowSettingsWhenConnectionChanged && (!isDatabaseSelectionEqual || isConnectionChanged))
                    {
                        ShowSettingsBox();
                    }

                    RefreshIndexes();
                }
                else
                {
                    labelDatabases.Caption    = Settings.ActiveHost.Databases.Count.ToString();
                    labelDatabases.Visibility = BarItemVisibility.Always;
                }
            }
        }