Beispiel #1
0
        protected void OnRemoveConnection()
        {
            DatabaseConnectionContext context = (DatabaseConnectionContext)CurrentNode.DataItem;

            if (MessageService.Confirm(
                    AddinCatalog.GetString("Are you sure you want to remove connection '{0}'?", context.ConnectionSettings.Name),
                    AlertButton.Remove))
            {
                ConnectionContextService.RemoveDatabaseConnectionContext(context);
            }
        }
Beispiel #2
0
        protected void OnEditConnection()
        {
            DatabaseConnectionContext  context = (DatabaseConnectionContext)CurrentNode.DataItem;
            DatabaseConnectionSettings newSettings;

            if (context.DbFactory.GuiProvider.ShowEditConnectionDialog(context.DbFactory,
                                                                       context.ConnectionSettings,
                                                                       out newSettings))
            {
                DatabaseConnectionContext newContext = new DatabaseConnectionContext(newSettings);
                ConnectionContextService.RemoveDatabaseConnectionContext(context);
                ConnectionContextService.AddDatabaseConnectionContext(newContext);
                newContext.Refresh();
            }
        }
Beispiel #3
0
        private void OnDropDatabaseThreaded(object state)
        {
            DatabaseConnectionContext context = (DatabaseConnectionContext)CurrentNode.DataItem;

            try {
                context.ConnectionPool.Initialize();
                ISchemaProvider     provider       = context.SchemaProvider;
                DatabaseSchema      db             = provider.CreateDatabaseSchema(context.ConnectionSettings.Database);
                IEditSchemaProvider schemaProvider = (IEditSchemaProvider)context.SchemaProvider;
                schemaProvider.DropDatabase(db);
                ConnectionContextService.RemoveDatabaseConnectionContext(context);
            } catch (Exception ex) {
                DispatchService.GuiDispatch(delegate {
                    MessageService.ShowException(ex);
                });
            }
        }
        protected virtual void OnButtonEditClicked(object sender, System.EventArgs e)
        {
            DatabaseConnectionSettings settings = null;
            DatabaseConnectionContext  ctx;

            if (comboConnection.DatabaseConnection != null)
            {
                ctx = comboConnection.DatabaseConnection;
                if (ctx.DbFactory.GuiProvider.ShowEditConnectionDialog(comboConnection.DatabaseConnection.DbFactory,
                                                                       comboConnection.DatabaseConnection.ConnectionSettings,
                                                                       out settings))
                {
                    DatabaseConnectionContext newContext = new DatabaseConnectionContext(settings);
                    ConnectionContextService.RemoveDatabaseConnectionContext(ctx);
                    ConnectionContextService.AddDatabaseConnectionContext(newContext);
                }
            }
        }