Exemple #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;

                pgFDB fdb = new pgFDB();

                UserData parameters = _advancedSettings.ToUserData();
                if (btnOnlyRepository.Checked)
                {
                    parameters.SetUserData("CreateDatabase", false);
                }

                fdb.Open(ConnectionString);

                if (!fdb.Create(txtDatabase.Text, parameters))
                {
                    MessageBox.Show(fdb.lastErrorMsg, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                //if (chkCreateReplicationDatamodel.Checked == true)
                {
                    string errMsg;
                    if (!gView.Framework.Offline.Replication.CreateRelicationModel(fdb, out errMsg))
                    {
                        MessageBox.Show("RepliCreateRelicationModel failed:\n" + errMsg, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                if (chkCreateConnection.Checked)
                {
                    string           connStr = FullConnectionString;
                    ConfigTextStream stream  = new ConfigTextStream("postgrefdb_connections", true, true);
                    string           id      = txtObject.Text;
                    stream.Write(FullConnectionString, ref id);
                    stream.Close();

                    _resultExObject = new ExplorerObject(null, id, FullConnectionString);
                }

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("FATAL ERROR: " + ex.Message);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }