c# - Callbacks how to pass bool -
i have project (wcf, xaml, c#), , in project have mediator class (which follows mediator pattern). allows classes register callbacks when actions have been completed (for example data loading database).
the 'register' method mediator looks follows:
public void register(action<object> callback, viewmodelmessages message) { internallist.addvalue(message, callback); }
then classes register notified @ points, whereby callbacks called. works fine.
the problem when attempt pass variable of type bool when action completed. in particular case, want message passed using mediator pattern when edit happening (user input editing of data). should pass along 'true' or 'false'. so, boolean type think.
the registration on side of class wants receive message so:
mediator.mediator.instance.register( (object o) => { // o boolean if (o == null) return; if ((o bool) == true) // editing in progress else // editing on "); }, mediator.mediator.viewmodelmessages.editcharactermode);
now tells me, object, 'o' can't bool because bool not nullable.
i feel tackle in ugly way making class bool in or that, since surely comes frequently, know if there graceful or more accepted solution this.
thanks time.
Comments
Post a Comment