Exemplo n.º 1
0
        private void TC_ProgramingLanguages_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (TC_ProgramingLanguages.SelectedIndex != -1)
            {
                if (TC_ProgramingLanguages.SelectedTab.Name != "NewProgramingLanguageForm")
                {
                    TabPage tabPage = TC_ProgramingLanguages.SelectedTab;
                    tabPage.Controls.Add(this.LB_CodeName);
                    tabPage.Controls.Add(this.TXTBOX_Code);
                    tabPage.Controls.Add(this.TXTBOX_CodeDescription);
                    BTN_DeleteProgramingLanguage.Show();
                    BTN_DeleteCode.Show();
                    BTN_DeleteCode.Enabled         = false;
                    TXTBOX_Code.Enabled            = false;
                    TXTBOX_CodeDescription.Enabled = false;

                    LoadCodeSnippetList(-1);
                    GB_AboutSoftware.Size = new Size(149, 219);
                }
                else
                {
                    BTN_DeleteProgramingLanguage.Hide();
                    BTN_DeleteCode.Hide();
                }
                BTN_SaveChanges.Hide();
                BTN_DropChanges.Hide();
                LB_CodeName.Enabled = true;
            }
        }
Exemplo n.º 2
0
 private void BTN_DropChanges_Click(object sender, EventArgs e)
 {
     TXTBOX_Code.Text            = ((CodeSnippet)LB_CodeName.SelectedItem).Code;
     TXTBOX_CodeDescription.Text = ((CodeSnippet)LB_CodeName.SelectedItem).Description;
     BTN_SaveChanges.Hide();
     BTN_DropChanges.Hide();
     BTN_DeleteCode.Show();
     LB_CodeName.Enabled = true;
 }
Exemplo n.º 3
0
 private void BTN_SaveChanges_Click(object sender, EventArgs e)
 {
     SQLCommand("UPDATE Codes SET code = '" + TXTBOX_Code.Text + "', description = '" + TXTBOX_CodeDescription.Text + "' WHERE id LIKE '" + ((CodeSnippet)LB_CodeName.SelectedItem).Id + "'");
     BTN_SaveChanges.Hide();
     BTN_DropChanges.Hide();
     BTN_DeleteCode.Show();
     LB_CodeName.Enabled = true;
     LoadCodeSnippetList(LB_CodeName.SelectedIndex);
 }
Exemplo n.º 4
0
        public Main()
        {
            InitializeComponent();

            TC_ProgramingLanguages.TabPages.RemoveAt(0);
            conn = new SQLiteConnection("Data Source=CodeLog.db;");
            try
            {
                conn.Open();
                LoadProgramingLanguagesList(-2);
            }
            catch (Exception ex)
            {
            }
            SQLCommand("CREATE TABLE IF NOT EXISTS ProgramingLanguages (id INTEGER PRIMARY KEY, name VARCHAR DEFAULT NULL)");
            SQLCommand("CREATE TABLE IF NOT EXISTS Codes (id INTEGER PRIMARY KEY, programinglanguage_id DEFAULT -1, name VARCHAR DEFAULT NULL, code VARCHAR DEFAULT NULL, description VARCHAR(170) DEFAULT NULL)");

            BTN_DeleteProgramingLanguage.Hide();
            BTN_DeleteCode.Hide();
            BTN_SaveChanges.Hide();
            BTN_DropChanges.Hide();
        }
Exemplo n.º 5
0
 private void TXTBOX_CodeDescription_TextChanged(object sender, EventArgs e)
 {
     if (LB_CodeName.SelectedIndex != -1)
     {
         try
         {
             if (((CodeSnippet)LB_CodeName.SelectedItem).Code != TXTBOX_Code.Text || ((CodeSnippet)LB_CodeName.SelectedItem).Description != TXTBOX_CodeDescription.Text)
             {
                 BTN_SaveChanges.Show();
                 BTN_DropChanges.Show();
                 BTN_DeleteCode.Hide();
                 LB_CodeName.Enabled = false;
             }
             else
             {
                 BTN_SaveChanges.Hide();
                 BTN_DropChanges.Hide();
                 BTN_DeleteCode.Show();
                 LB_CodeName.Enabled = true;
             }
         }
         catch { }
     }
 }