Esempio n. 1
0
        Task ResizeDrawerAsync(double start, double end)
        {
            var tcs = new TaskCompletionSource <bool>();

            var animation = new Animation(v =>
            {
                var r = start + ((end - start) * v);
                ContentViewGroup.UpdatePosition(new Point(r, 0));
                DrawerViewGroup.UpdateSize(new Size(r, Size.Height));
            }, easing: Easing.Linear);

            animation.Commit(this, "ResizeDrawer", length: 200, finished: (l, c) =>
            {
                ContentViewGroup.UpdatePosition(new Point(end, 0));
                DrawerViewGroup.UpdateSize(new Size(end, Size.Height));

                tcs.SetResult(true);
            });

            return(tcs.Task);
        }
        async Task RunCustomPopAnimation(View tobeRemoved, Action <View, double> customAnimation)
        {
            tobeRemoved.Sensitive = false;
            if (BelowTop != null)
            {
                BelowTop.Show();
                BelowTop.Sensitive = false;
            }

            var tcs     = new TaskCompletionSource <bool>();
            var pushAni = new Animation((d) => customAnimation(tobeRemoved, d), easing: Easing.Linear);

            pushAni.Commit(this, "PopAnimation", finished: (d, b) =>
            {
                tcs.SetResult(true);
            });
            await tcs.Task;

            tobeRemoved.Sensitive = true;
            if (BelowTop != null)
            {
                BelowTop.Sensitive = true;
            }
        }
        async Task RunCustomPushAnimation(View view, Action <View, double> customAnimation)
        {
            if (Top != null)
            {
                Top.Sensitive = false;
            }

            view.Sensitive = false;
            var tcs     = new TaskCompletionSource <bool>();
            var pushAni = new Animation((d) => customAnimation(view, d), easing: Easing.Linear);

            pushAni.Commit(this, "PushAnimation", finished: (d, b) =>
            {
                tcs.SetResult(true);
            });
            await tcs.Task;

            view.Sensitive = true;

            if (Top != null)
            {
                Top.Sensitive = true;
            }
        }