private void btnDelete_Clicked(object sender, EventArgs e) { Button btn = (Button)sender; Payment payment = btn.Data ["Payment"] as Payment; if (payment == null) { return; } using (MessageOkCancel dialog = new MessageOkCancel( Translator.GetString("Delete Payment"), "Icons.TradePoint32.png", Translator.GetString("Do you want to delete the selected payment?"), "Icons.Delete32.png")) { if (dialog.Run() != ResponseType.Ok) { return; } } payments.Remove(payment); RefreshGrid(); parentWindow.Resize(10, 10); txtReceived.GrabFocus(); OnPaymentDeleted(EventArgs.Empty); }
public void btnDelete_Clicked(object sender, EventArgs e) { T group = gPanel.GetSelectedGroup(); DeletePermission permission = GetDeletePermission(group); switch (permission) { case DeletePermission.InUse: MessageError.ShowDialog( Translator.GetString("This group cannot be deleted, because it is not empty. Please, delete or move to another group the containing items in order to delete this group!"), "Icons.Group16.png"); return; case DeletePermission.Reserved: case DeletePermission.No: MessageError.ShowDialog( string.Format(Translator.GetString("Cannot delete group \"{0}\"!"), group.Name), "Icons.Group16.png"); return; } using (MessageOkCancel dialog = new MessageOkCancel( Translator.GetString("Delete group"), "Icons.Group16.png", string.Format(Translator.GetString("Do you want to delete group with name \"{0}\"?"), group.Name), "Icons.Delete32.png")) { if (dialog.Run() != ResponseType.Ok) { return; } } DeleteGroup(group); ReloadGroups(); if (group.Parent != null) { gPanel.SelectGroupId(group.Parent.Id); } else { gPanel.SelectGroupId(-1); } OnGroupDeleted(); }