Ejemplo n.º 1
0
        private void connectToDB()
        {
            //Connect to Database
            Editor.applicationSettings = (RyotianEd.ApplicationSettings)Editor.DeserializeFromXml(typeof(RyotianEd.ApplicationSettings));
            if (Editor.applicationSettings == null)
            {
                Editor.applicationSettings = new ApplicationSettings();
            }

            if (Editor.applicationSettings.DatabaseOptions != null && DBConnectHelper.connect(Editor.applicationSettings.DatabaseOptions))
            {
                toolStripStatusLabel1.Text = "Connected to " + Editor.applicationSettings.DatabaseOptions.server;
            }
        }
Ejemplo n.º 2
0
        private void dbButton1_Click(object sender, EventArgs e)
        {
            //serialize database connection
            Editor.applicationSettings.DatabaseOptions = new DatabaseSettings();
            DatabaseSettings setting = Editor.applicationSettings.DatabaseOptions;

            setting.server   = hostTextBox1.Text;
            setting.user     = this.userTextBox2.Text;
            setting.password = passwordTextBox3.Text;

            if (DBConnectHelper.connect(setting))
            {
                String status = "Connected to " + hostTextBox1.Text;
                mLabel.Text = status;

                //serialize application setting
                Editor.SerializeToXml(Editor.applicationSettings, typeof(ApplicationSettings));
                DialogResult = DialogResult.OK;
                Close();
            }
        }