示例#1
0
        public async void Play(double from, double to, ViewManagerEvent <LottieAnimationView, Dictionary <string, bool> > completion)
        {
            if (!LottiePlayer.IsAnimatedVisualLoaded)
            {
                var d = Window.Current.Dispatcher;
                _ = Task.Delay(100).ContinueWith(t =>
                {
                    _ = d.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                        Play(from, to, completion);
                    });
                });
                return;
            }

            _playback = LottiePlayer.PlayAsync(from, to, Loop).AsTask();

            await _playback;

            if (completion != null && _playback.IsCompleted)
            {
                completion.Invoke(this, new Dictionary <string, bool> {
                    { "isCancelled", _playback.IsCanceled || _playback.IsFaulted }
                });
            }
        }
        /// #######################################################################################
        public async Task <bool> ShowRatingReviewDialog()
        {
            StoreContext             _storeContext = StoreContext.GetDefault();;
            StoreRateAndReviewResult result        = await _storeContext.RequestRateAndReviewAppAsync();

            switch (result.Status)
            {
            case StoreRateAndReviewStatus.Succeeded:
                await LottiePlayer.PlayAsync(0, 1, false);

                break;

            case StoreRateAndReviewStatus.CanceledByUser:
                break;

            case StoreRateAndReviewStatus.Error:
            case StoreRateAndReviewStatus.NetworkError:
                await new MessageDialog("Something went wrong.").ShowAsync();
                break;

            default:
                break;
            }
            // There was an error with the request, or the customer chose not to
            // rate or review the app.
            return(false);
        }