private async Task RegisterEventAsync(string jsMethodName, List <KeyValuePair <ElementReference, string> > registeredEvents, ElementReference elementRef, Func <AnimationEventArgs, Task> onEventCallback, string animationName) { await CheckJsObjectAsync(); var info = new AnimationEventInfo(elementRef, onEventCallback, animationName); var dotnetRef = DotNetObjectReference.Create <AnimationEventInfo>(info); await _animationJs.InvokeVoidAsync(jsMethodName, elementRef, dotnetRef, animationName); registeredEvents.Add(new KeyValuePair <ElementReference, string>(elementRef, animationName)); }
public async Task RegisterAnimationsWhenAllEndedAsync(Func <AnimationEventArgs[], Task> onEndedCallback, params KeyValuePair <ElementReference, string>[] elementRefsWithProperties) { await CheckJsObjectAsync(); var collection = new AnimationCollectionInfo(onEndedCallback); foreach (var item in elementRefsWithProperties) { var info = new AnimationEventInfo(item.Key, collection.WhenAllFinished, item.Value); collection.Add(info); var dotnetRef = DotNetObjectReference.Create <AnimationEventInfo>(info); _registeredEndEvents.Add(dotnetRef); await _animationJs.InvokeVoidAsync("addAnimationEnd", item.Key, dotnetRef, item.Value); } }