private void DeleteSelectedParty() { try { if (partyDataGrid.SelectedItems.Count == 0) { throw (new Exception("Please select an item to delete")); } PartyService.PartySummary partySummary = (PartyService.PartySummary)partyDataGrid.SelectedItem; MessagePopUp confirmDelete = new MessagePopUp( string.Format("Are you sure you want to delete [{0}]?", partySummary.Name), MessagePopUp.MessagePopUpType.YesNo); confirmDelete.Closed += ConfirmDeleteHandler; confirmDelete.Show(); } catch (Exception ex) { formBusyIndicator.IsBusy = false; app.ShowError(ex.Message); } }
private void DeleteCompleted(object sender, UploadStringCompletedEventArgs e) { try { CheckForErrors(e); string returnTypeName = app.GetBusinessObjectType(e.Result); switch (returnTypeName) { case "Acknowledgement": PartyService.Acknowledgement ack = app.LoadBusinessObject <PartyService.Acknowledgement>(e.Result); MessagePopUp ackPopUp = new MessagePopUp(ack.Message, MessagePopUp.MessagePopUpType.OK); ackPopUp.Show(); break; case "Error": PartyService.Error err = app.LoadBusinessObject <PartyService.Error>(e.Result); throw (new Exception(err.Message)); default: throw (new Exception("Unrecognised object type in server response")); } } catch (Exception ex) { app.ShowError(ex.Message); } finally { formBusyIndicator.IsBusy = false; } }
private void DeleteCompleted(object sender, UploadStringCompletedEventArgs e) { try { CheckForErrors(e); string returnTypeName = app.GetBusinessObjectType(e.Result); switch (returnTypeName) { case "Acknowledgement": PartyService.Acknowledgement ack = app.LoadBusinessObject<PartyService.Acknowledgement>(e.Result); MessagePopUp ackPopUp = new MessagePopUp(ack.Message, MessagePopUp.MessagePopUpType.OK); ackPopUp.Show(); break; case "Error": PartyService.Error err = app.LoadBusinessObject<PartyService.Error>(e.Result); throw (new Exception(err.Message)); default: throw (new Exception("Unrecognised object type in server response")); } } catch (Exception ex) { app.ShowError(ex.Message); } finally { formBusyIndicator.IsBusy = false; } }
protected void CheckBusyAskCancel() { if (this.webClient != null && this.webClient.IsBusy) { MessagePopUp mpu = new MessagePopUp( "Operation in progress: do you want to cancel it?", MessagePopUp.MessagePopUpType.YesNo); mpu.Closed += CancelOperationPopUpHandler; } }
protected void Cancel() { if (this.isDirty) { MessagePopUp mpu = new MessagePopUp( "Changes have been made: do you want to save?", MessagePopUp.MessagePopUpType.YesNoCancel); mpu.Closed += CancelPopUpHandler; mpu.Show(); } else { RevertContent(); } }
protected void CancelOperationPopUpHandler(object sender, EventArgs e) { MessagePopUp mpu = (MessagePopUp)sender; switch (mpu.Result) { case MessagePopUp.MessagePopUpResult.Yes: if (this.webClient != null && this.webClient.IsBusy) { this.webClient.CancelAsync(); } break; case MessagePopUp.MessagePopUpResult.No: default: // do nothing break; } }
protected void CancelPopUpHandler(object sender, EventArgs e) { MessagePopUp mpu = (MessagePopUp)sender; switch (mpu.Result) { case MessagePopUp.MessagePopUpResult.Yes: Save(); break; case MessagePopUp.MessagePopUpResult.No: RevertContent(); break; case MessagePopUp.MessagePopUpResult.Cancel: default: // do nothing break; } }
public void ShowError(string message) { MessagePopUp mpu = new MessagePopUp(message, MessagePopUp.MessagePopUpType.OK); mpu.Show(); }