public static void LoadAllNotes() { List <FormData> data = new List <FormData>(); foreach (string id in REGISTRY.OPENED_NOTES) { object val = REGISTRY.GetData(id); if (val != null) { data.Add((FormData)val); } } CUR_ID = 1; foreach (FormData dat in data) { AddNewNote(dat); } if (CUR_ID == 1) { AddNewNote(); } REGISTRY.DeleteAll(); SaveAllNotes(); }
// // save and load data // public bool Save() { try { REGISTRY.SetData(FORM_ID.ToString(), new FormData(this)); return(true); } catch { return(false); } }
private void deleteSelected_Click(object sender, EventArgs e) { if (listView1.CheckedItems == null) { return; } if (MessageBox.Show("Are you sure to delete all selected notes?", "Delete All?", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { return; } foreach (ListViewItem litm in listView1.CheckedItems) { MainForm form = (MainForm)litm.Tag; REGISTRY.Delete(form.FORM_ID.ToString()); Program.EmptySlots.Enqueue(form.FORM_ID); form.Close(); } LoadAllNotes(); }
// // Sure Dialog // private void yesButton_Click(object sender, EventArgs e) { REGISTRY.Delete(FORM_ID.ToString()); Program.EmptySlots.Enqueue(FORM_ID); this.Close(); }