private void Form1_Load(object sender, EventArgs e) { //Still somehow doesn't work until the user move the mouse around it TextboxDefaultColor(); if (FileManagement.IsStartupItem("NoteTaker")) { ChangeContextMenuStripItem2(); } //Organizing the numeritation in case the user removed a note, for exemple:[ 1) First note, 3) Third note] should be corrected to [ 1) First note, 2) Third note] FileManagement.OrganizeNumérotation(); }
private void btnSave_Click(object sender, EventArgs e) { if (File.Exists(FileManagement.logPath)) { try { FileManagement.Numéro(); FileManagement.InsertValue(txtNote.Text); ClearTextbox(); //Shows a "message" that the note was taken NoteTakenNotification(); } catch (Exception Xerror) { throw Xerror; } } else { DialogResult dialogResult = MessageBox.Show("File does not exist!\r\nDo you want to create it?", "Error", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { try { FileManagement.CreateFile(); //Re-saves the note after creating the text file FileManagement.Numéro(); FileManagement.InsertValue(txtNote.Text); ClearTextbox(); //Shows a "message" that the note was taken NoteTakenNotification(); } catch (Exception Xerror2) { throw Xerror2; } } else if (dialogResult == DialogResult.No) { DialogResult dialogueResult2 = MessageBox.Show("You need a file to store your notes!\r\nDo you want to create it?", "Warning", MessageBoxButtons.YesNo); if (dialogueResult2 == DialogResult.Yes) { try { FileManagement.CreateFile(); //Write in the next line after a new line(write at a new line after another line) FileManagement.Numéro(); FileManagement.InsertValue(txtNote.Text); ClearTextbox(); //Shows a "message" that the note was taken NoteTakenNotification(); } catch (Exception Xerror3) { throw Xerror3; } } else if (dialogResult == DialogResult.No) { MessageBox.Show("File was not created!\r\nNote was not saved!"); } } } }