private void addButton_Click(object sender, System.EventArgs e) { string text = ": nowa kategoria"; string label = "Podaj nową kategorię:"; EditForm form = new EditForm(text, label); form.EditEvent += this.AddCategory; form.ShowDialog(this); this.editButton.Enabled = false; this.deleteButton.Enabled = false; }
private void editButton_Click(object sender, System.EventArgs e) { string old = this.listView.SelectedItems[0].Text; string text = ": edycja"; string label = "Podaj nazwę kategorii, która ma zastąpić '" + old + "'."; EditForm form = new EditForm(text, label); form.EditEvent += x => this.EditCategory(x, old); form.ShowDialog(this); }
/// <summary> /// Wyświetla okno tworzenia nowego profilu. /// </summary> /// <remarks> /// Ostrzega o możliwości utraty danych. /// </remarks> private void NewProfile() { DialogResult result = DialogResult.None; bool create = false; if(this.isProfileChanged) { string text = "Na pewno chcesz utowrzyć nowy profil?\nNiezapisane dane zostaną utracone."; result = MainForm.MessageBoxWrapper(text, MessageType.WYesNo); create = result == DialogResult.Yes; } else create = true; if(create) { string text = ": nowy profil"; string label = "Podaj nazwę nowego profilu:"; EditForm form = new EditForm(text, label); form.EditEvent += this.CreateNewProfile; form.ShowDialog(this); } }