private void ConnectClicked()
        {
            AllDataBases.Clear();
            Analyse.OnCanExecuteChanged();

            // connection check
            var masterDBConnString = ConnectionStringBuilder.MasterDBConnectionStringCreate(SqlConnectionSettingsViewModel);

            if (!_sqlExecutor.ConnectionIsValid(masterDBConnString))
            {
                HelpText = INIT_TEXT;
                OnPropertyChanged("HelpText");
                OnPropertyChanged("DataBasesForChart");
                _mainView.Dialogs.Error(@"Can't connect to server. Check connection settings, and make sure you have rights to connect that server.");
                return;
            }

            // databases info load
            ThreadPool.QueueUserWorkItem(delegate
            {
                foreach (string dbName in _sqlExecutor.LoadDatabaseList(masterDBConnString))
                {
                    var dbInfo = _dbInfoBuilder.Create(ConnectionStringBuilder.ConnectionStringCreate(SqlConnectionSettingsViewModel, dbName), dbName);
                    Dispatcher.Invoke(new Action(() => AllDataBases.Add(new DBInfoListItem(dbInfo, this))));
                }
                Dispatcher.Invoke(new Action(CheckBiggestDBs));
                HelpText = AFTER_INIT_TEXT;
                OnPropertyChanged("HelpText");
                RefreshChartBinding();
                Dispatcher.Invoke(new Action(() => Analyse.OnCanExecuteChanged()));
            });
        }
 private void _view_AnalyseClicked(object sender, EventArgs e)
 {
     if (_view.SelectedDatabase != null)
     {
         using (IDatabaseDetailsView detailsView = _view.CreateDatabaseDetailsView())
         {
             using (var presenter = new DatabaseDetailsPresenter(detailsView, _sqlExecutor,
                                                                 ConnectionStringBuilder.ConnectionStringCreate(_view.SettingsView, _view.SelectedDatabase.Name),
                                                                 _view.SelectedDatabase.Name))
             {
                 detailsView.ShowModal();
             }
         }
     }
 }
        private void _view_ConnectClicked(object sender, EventArgs e)
        {
            if (!_sqlExecutor.ConnectionIsValid(ConnectionStringBuilder.MasterDBConnectionStringCreate(_view.SettingsView)))
            {
                _view.ShowError(@"Can't connect to server. Check connection settings, and make sure you have rights to connect that server.");
                return;
            }
            var databases = new List <IDBInfo>();

            foreach (string dbName in _sqlExecutor.LoadDatabaseList(ConnectionStringBuilder.MasterDBConnectionStringCreate(_view.SettingsView)))
            {
                var dbInfo = _dbInfoBuilder.Create(ConnectionStringBuilder.ConnectionStringCreate(_view.SettingsView, dbName), dbName);
                databases.Add(dbInfo);
            }
            _view.SetDbListDataSource(databases, databases.OrderByDescending(x => x.TotalSizeMB).Take(DEFAULT_NUM_OF_DB_TO_SHOW).ToList());
        }