public async Task PushAsync(PopupPage page, bool animate = true) { lock (_popupStack) { if (_popupStack.Contains(page)) { return; } _popupStack.Add(page); page.IsBeingAppear = true; } try { animate = CanBeAnimated(animate); if (animate) { page.PreparingAnimation(); } await AddAsync(page); if (animate) { await page.AppearingAnimation(); } } finally { page.IsBeingAppear = false; } }
public Task PushAsync(PopupPage page, bool animate = true) { return(InvokeThreadSafe(async() => { if (page.IsBeingAppeared) { return; } page.IsBeingAppeared = true; animate = CanBeAnimated(animate); if (animate) { page.PreparingAnimation(); await AddAsync(page); await page.AppearingAnimation(); } else { await AddAsync(page); } page.IsBeingAppeared = false; })); }
public Task PushAsync(PopupPage page, bool animate = true) { lock (_locker) { if (_popupStack.Contains(page)) { throw new InvalidOperationException("The page has been pushed already. Pop or remove the page before to push it again"); } _popupStack.Add(page); var task = InvokeThreadSafe(async() => { animate = CanBeAnimated(animate); if (animate) { page.PreparingAnimation(); await AddAsync(page); await page.AppearingAnimation(); } else { await AddAsync(page); } page.AppearingTransactionTask = null; }); page.AppearingTransactionTask = task; return(task); } }
public async Task PushAsync(PopupPage page, bool animate = true) { if (animate) { page.PreparingAnimation(); await AddAsync(page); await Task.Delay(10); await page.AppearingAnimation(); } else { await AddAsync(page); } }
public static Task PushAsync(PopupPage page, bool animate = true) { var task = new TaskCompletionSource <bool>(); if (animate) { page.PreparingAnimation(); page.ExecuteWhenAppearingOnce(async() => { await page.AppearingAnimation(); task.TrySetResult(true); }); } DependencyService.Get <IPopupNavigation>().AddPopup(page); _popupStack.Add(page); if (!animate) { task.TrySetResult(true); } return(task.Task); }
public static Task PushAsync(PopupPage page, bool animate = true) { var task = new TaskCompletionSource <bool>(); var parent = GetParentPage(); page.Parent = parent; if (animate) { page.PreparingAnimation(); page.Appearing += async(sender, args) => { await page.AppearingAnimation(); task.TrySetResult(true); }; } DependencyService.Get <IPopupNavigation>().AddPopup(page); _popupStack.Add(page); if (!animate) { task.TrySetResult(true); } return(task.Task); }