public void OnUserFeedback(object sender, UserFeedbackEventArgs userFeedbackEventArgs) { if (this.UserFeedback != null) { this.UserFeedback(sender, userFeedbackEventArgs); } }
private bool HandleUserFeedbackRequest(UserFeedbackEventArgs args) { if (UserFeedbackUsesOverlays) { if (args is ExceptionFeedbackEventArgs) { Feedback(new ExceptionFeedbackVM(), (ExceptionFeedbackEventArgs )args); } else if (args is DetailMessageFeedbackEventArgs) { Feedback(new DetailMessageFeedbackVM(), (DetailMessageFeedbackEventArgs)args); } else if (args is MessageFeedbackEventArgs) { Feedback(new MessageFeedbackVM(), (MessageFeedbackEventArgs )args); } else if (args is InputFeedbackEventArgs) { Feedback(new InputFeedbackVM(), (InputFeedbackEventArgs )args); } // else if(args is OpenFileFeedbackEventArgs ) Feedback(new OpenFileFeedbackVM (),(OpenFileFeedbackEventArgs ) args); // else if(args is SaveFileFeedbackEventArgs ) Feedback(new SaveFileFeedbackVM (),(SaveFileFeedbackEventArgs ) args); else { return(false); } } return(false); }
/// <summary> [EXPERIMENTAL] override RequestUserFeedbackCore for overlays /// </summary> /// <param name="args">The <see cref="UserFeedbackEventArgs" /> instance containing the event data.</param> protected override void RequestUserFeedbackCore(UserFeedbackEventArgs args) { if (!HandleUserFeedbackRequest(args)) { base.RequestUserFeedbackCore(args); } }
/// <summary> Requests a user feedback. /// </summary> /// <param name="args">The <see cref="UserFeedbackEventArgs"/> instance containing the event data.</param> /// <param name="callback"> The callback method which is called after feedback </param> /// <param name="state"> a user-defined object that qualifies or contains information about an feedback operation. </param> public void RequestUserFeedback(UserFeedbackEventArgs args, Action <UserFeedbackEventArgs> callback = null, object state = null) { if (callback != null || state != null) { args.AsyncCallback = callback; args.AsyncCallbackParameters = state; } RequestUserFeedbackCore(args); }
protected virtual void RequestUserFeedbackCore(UserFeedbackEventArgs args) { if (args.Source == null) { args.Source = this; } //Routing strategy: bubble to root until first handler found which sets the IsHandled/IsHandledAsync to true if (UserFeedbackRequested != null) { EventUtil.Raise(UserFeedbackRequested, this, args, "{B85E48C5-EBC3-401C-A4F9-D89E930D7278}"); if (args.AsyncHandled) { return; } if (args.Handled) { return; } } if (LazyWeakEventStore.IsValueCreated) { EventManager.Raise <EventHandler <UserFeedbackEventArgs>, UserFeedbackEventArgs>(LazyWeakEventStore, "UserFeedbackRequestedEvent", args); if (args.AsyncHandled) { return; } if (args.Handled) { return; } } if (Parent is ObjectBM) { ((ObjectBM)Parent).RequestUserFeedbackCore(args); } else if (Parent != null) { Parent.RequestUserFeedback(args); } else { throw new NotImplementedException("UserFeedbackRequested handler not registered and no parent present!" + "\n\t" + "Model: " + DebugUtil.FormatTypeName(this) + "\n\t" + "OriganalSource: " + DebugUtil.FormatTypeName(args.Source) + "\n\t" + "EventArgs: " + DebugUtil.FormatTypeName(args) + "\n\t" + "ErrorID: {8502A3BA-6131-436C-9D2F-627391E060D8}"); } }
/// <summary> /// Handles UserFeedbacks /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void viewModelEvents_UserFeedback(object sender, UserFeedbackEventArgs e) { e.Result = MessageBox.Show(mainWindow, e.Message, e.Caption, e.Button, e.Image); }
protected virtual void RequestUserFeedbackCore(UserFeedbackEventArgs args) { if (args.Source == null) { args.Source = this; } //Routing strategy: bubble to root until first handler found if (UserFeedbackRequested != null) { UserFeedbackRequested(this, args); } if (args.AsyncHandled) { return; } if (args.Handled) { if (args.AsyncCallback != null) { args.AsyncCallback(args); } return; } //TODO revise calling of AsyncCallback EventManager.Raise <EventHandler <UserFeedbackEventArgs>, UserFeedbackEventArgs>(LazyWeakEventStore, "UserFeedbackRequestedEvent", args); if (args.AsyncHandled) { return; } if (args.Handled) { if (args.AsyncCallback != null) { args.AsyncCallback(args); } return; } //TODO revise calling of AsyncCallback if (Parent is ObjectVM) { ((ObjectVM)Parent).RequestUserFeedbackCore(args); } else if (Parent != null) { Parent.RequestUserFeedback(args); } else { //TODO: revise no UserFeedbackRequested handler registered if (args is BusyUserFeedbackEventArgs && ((BusyUserFeedbackEventArgs)args).IsBusy == true) { //if no one in the hierarchy uses e.g. BusyAdornerBehavior ignore this RequestUserFeedback Debug.WriteLine("WARNING: UserFeedbackRequested handler (for BusyUserFeedbackEventArgs) not registered and no parent present!" + "\n\t" + "ViewModel: " + DebugUtil.FormatTypeName(this) + "\n\t" + "ErrorID: {58358DEA-4028-413D-9BCD-641A8AA07BE5}" ); return; } throw new NotImplementedException("UserFeedbackRequested handler not registered and no parent present!" + "\n " + "Model: " + DebugUtil.FormatTypeName(this) + "\n " + "OriginalSource: " + DebugUtil.FormatTypeName(args.Source) + "\n " + "EventArgs: " + DebugUtil.FormatTypeName(args) + "\n " + "ErrorID: {EA0BF43D-740F-4543-B67C-4E1D755252E1}"); } }
public void OnUserFeedback(object sender, UserFeedbackEventArgs e) { this.events.OnUserFeedback(sender, e); }
public void RequestUserFeedback(UserFeedbackEventArgs args) { RequestUserFeedbackCore(args); }
public void HandleApplicationUserFeedbackRequests(UserFeedbackEventArgs args) { HandleUserFeedbackRequest(args); }