BlazorPlus icon indicating copy to clipboard operation
BlazorPlus copied to clipboard

How to handle exception when a component can not inherit BlazorPlusComponentBase

Open tiansfather opened this issue 4 years ago • 2 comments

Hi,I'm using your BlazorPlus.It's very cool you just throw exception and caught by blazorsession.But some component are not able to inherit from BlazorPlusComponentBase.So is there any solution to handle this situation? Thanks.

tiansfather avatar Mar 11 '21 07:03 tiansfather

Try Implement the

Task IHandleEvent.HandleEventAsync(EventCallbackWorkItem item, object arg)

` public abstract class YourComponent : ComponentBase, IHandleEvent { [Inject] public BlazorSession Session { get; set; }

	Task IHandleEvent.HandleEventAsync(EventCallbackWorkItem item, object arg)
	{
		return Session.HandleEventAsync(item, arg, delegate
		 {
			 StateHasChanged();
		 });
	}

}

`

BlazorPlus avatar Mar 27 '21 02:03 BlazorPlus

Thanks very much

tiansfather avatar Mar 27 '21 06:03 tiansfather