/// <summary> /// Called by ConfirmationPopup after the user has chosen OK or Cancel /// </summary> public void ConfirmationFinished() { ConfirmationPopup popup = (ConfirmationPopup)CurrentPopup; CurrentPopup = null; ActionAwaitingConfirmation action = (ActionAwaitingConfirmation)popup.UserData; switch (action) { case ActionAwaitingConfirmation.New: if (popup.DidConfirm) { _imageUnsaved = false; CreatePaintableImage(); } break; case ActionAwaitingConfirmation.Load: if(popup.DidConfirm) CurrentPopup = new LoadPopup(this); break; case ActionAwaitingConfirmation.Close: if (popup.DidConfirm) Close(); break; } }
// Called when the user presses the 'Load' button private void OnLoad(object sender, RoutedEventArgs args) { if (_imageUnsaved) CurrentPopup = new ConfirmationPopup("Unsaved changes will be lost! Continue?", ActionAwaitingConfirmation.Load, this); else CurrentPopup = new LoadPopup(this); }