示例#1
0
        private void Connect()
        {
            var databaseName = Connection.SelectedConnection;

            if (string.IsNullOrEmpty(databaseName))
            {
                StatusText = "No connection selected";
                return;
            }
            if (_communicator.IsConnected)
            {
                StatusText = string.Format("Already conneced to {0}", _communicator.ConnectedTo);
                return;
            }
            var database = _settings.CurrentContext.GetDatabase(databaseName);

            if (database == null)
            {
                StatusText = string.Format("Invalid connection {0}", Connection.SelectedConnection);
                return;
            }

            _communicator.ConnectTo(database);

            FireOnConnectionPropertiesChanged();
            if (_settings.LoadSchema)
            {
                StatusText        = "Loading schema objects";
                _typeCache.Schema = _communicator.LoadSchema();
            }
            StatusText = string.Format("Connected to {0}", _communicator.ConnectedTo);
        }
示例#2
0
        private void Connect()
        {
            if (Connection.SelectedConnection.IsNullOrEmpty())
            {
                Model.StatusText = "No connection selected";
                return;
            }
            if (_communicator.IsConnected)
            {
                Model.StatusText = string.Format("Already connected to {0}", _communicator.ConnectedTo);
                return;
            }

            var database = _settings.CurrentContext.GetDatabase(Connection.SelectedConnection);

            if (database == null)
            {
                Model.StatusText = string.Format("Invalid connection {0}", Connection.SelectedConnection);
            }

            _communicator.ConnectTo(database);
            if (_settings.LoadSchema)
            {
                Model.StatusText  = "Loading schema objects";
                _typeCache.Schema = _communicator.LoadSchema();
            }
            Model.Title      = string.Format("DbTool - {0}", _communicator.ConnectedTo);
            Model.StatusText = string.Format("Connected to {0}", _communicator.ConnectedTo);
            Connection.ShowConnected(true);
        }