Exentials.MdcBlazor.Tools by Gambarotto Damiano

<PackageReference Include="Exentials.MdcBlazor.Tools" Version="0.7.8-alpha" />

 MdcSnackbarService

using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.CompilerServices; using Microsoft.AspNetCore.Components.Rendering; using System.Runtime.CompilerServices; using System.Threading.Tasks; namespace Exentials.MdcBlazor { public class MdcSnackbarService { private MdcSnackbar MdcSnackbar { get; set; } [Inject] private SnackbarService SnackbarService { get; set; } protected override void OnInitialized() { this.OnInitialized(); SnackbarService.ShowRequested += ShowSnackbar; } [AsyncStateMachine(typeof(<ShowSnackbar>d__9))] private ValueTask ShowSnackbar(ISnackbarOptions options) { <ShowSnackbar>d__9 stateMachine = default(<ShowSnackbar>d__9); stateMachine.<>t__builder = AsyncValueTaskMethodBuilder.Create(); stateMachine.<>4__this = this; stateMachine.options = options; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; } private ValueTask ShowNext(string reason) { return SnackbarService.NotifyClose(reason); } public override ValueTask DisposeAsync() { SnackbarService.ShowRequested -= ShowSnackbar; return this.DisposeAsync(); } protected override void BuildRenderTree(RenderTreeBuilder __builder) { __builder.OpenComponent<MdcSnackbar>(0); __builder.AddAttribute(1, "OnClosed", Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck(EventCallback.Factory.Create(this, delegate(string args) { ShowNext(args); }))); __builder.AddComponentReferenceCapture(2, delegate(object __value) { MdcSnackbar = __value; }); __builder.CloseComponent(); } public MdcSnackbarService() : this() { } } }