private void btnSave_Click(object sender, EventArgs e)
        {
            string connectionString = txtConnectionString.Text;
            if (!String.IsNullOrEmpty(connectionString) && !String.IsNullOrWhiteSpace(connectionString))
            {
                //check if the sql connection will work.
                if (IsValidConnectionString(connectionString))
                {
                    //write the connection string to the app.config file.
                    List<string> keys = new List<string>();
                    keys.Add("TimeTracker_db");
                    keys.Add("TimeTracker.Properties.Settings.TimeTrackerConnectionString");

                    UpdateConnectionString(keys, connectionString);

                    //Create the SQL table.
                    CreateTimeTrackerTable();

                    //display a set your time dialog.
                    frmTimeEditor time = new frmTimeEditor();
                    time.Show();
                    this.Hide();
                }
                else
                {
                    //display an error message.
                    lblError.Visible = true;
                }
            }
            else
            {
                //display an error message.
                lblError.Visible = true;
            }
        }
示例#2
0
 private void preferencesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     frmTimeEditor frmTime = new frmTimeEditor();
     frmTime.Show();
     Close();
 }