コード例 #1
0
        public MySqlCreateDatabaseDialog(IDbFactory factory) : base(factory)
        {
            createDBWidget = new MySqlCreateDatabaseWidget();
            Notebook.AppendPage(createDBWidget,
                                new Label(AddinCatalog.GetString("Database Properties")));
            Notebook.ShowTabs = true;
            Gtk.Notebook nb = Notebook;

            nb.SwitchPage += delegate(object o, SwitchPageArgs args) {
                if (nb.CurrentPage == 1)
                {
                    if (!connectionWidget.ValidateFields())
                    {
                        nb.CurrentPage = 0;
                        MessageService.ShowError(this,
                                                 AddinCatalog.GetString("Set the connection properties before the database properties."));
                    }
                    else
                    {
                        Initialize(factory);
                        if (DatabaseConnection.ConnectionPool.HasErrors)
                        {
                            MessageService.ShowError(DatabaseConnection.ConnectionPool.Error);
                            nb.CurrentPage = 0;
                            return;
                        }
                        createDBWidget.Initialize((MySqlSchemaProvider)DatabaseConnection.SchemaProvider);
                    }
                }
            };

            Notebook.ShowAll();
        }
コード例 #2
0
 protected virtual void Validate(object sender, EventArgs e)
 {
     buttonOk.Sensitive = settingsWidget.ValidateFields();
 }