public void ChangeToLastByPool(int index, ISliderAnimation animation = null) { if (_pool.ContainsKey(index) && _pool[index].Count > 0) { var target = _pool[index].Last(); OnChangePage(target, animation); } }
protected async void PageService_PageChanged(Page page, ISliderAnimation animation) { ISliderAnimation anim = animation ?? defaultAnim; if (CurrentPage != null) { await anim.AnimateOldPage(CurrentPage.Content as UIElement); } //(page.Content as UIElement).Opacity = 0; CurrentPage = page; await anim.AnimateNewPage(CurrentPage.Content as UIElement); }
public void Back <TPage>(int poolIndex, ISliderAnimation anim = null) where TPage : Page, new() { if (_pool.ContainsKey(poolIndex) && _pool[poolIndex].Count > 1 && _pool[poolIndex].Any(x => x.GetType() == typeof(TPage))) { var list = _pool[poolIndex]; var target = list.Find(x => x.GetType() == typeof(TPage)); int index = list.IndexOf(target); _pool[poolIndex].RemoveRange(index + 1, list.Count - index - 1); OnChangePage(target, anim); } }
async void SetWorker(int index, ISliderAnimation anim = null) { IsLeftMaximum = index == 0; IsRightMaximum = index == workers.Count - 1; if (anim != null) { await anim.AnimateOldPage(Control.Content as UIElement); } CurrentWorker = workers[index]; if (anim != null) { await anim.AnimateNewPage(Control.Content as UIElement); } }
public void Back(int poolIndex, ISliderAnimation anim = null) { if (_pool.ContainsKey(poolIndex)) { if (_pool[poolIndex].Count > 1) { Page last = _pool[poolIndex].LastOrDefault(); Page target = _pool[poolIndex].Skip(_pool[poolIndex].Count - 2).FirstOrDefault(); _pool[poolIndex].Remove(last); OnChangePage(target, anim); } else if (_poolHistory.IndexOf(poolIndex) > 0) { int index = _poolHistory.IndexOf(poolIndex) - 1; ActualPool = _poolHistory[index]; ChangeToLastByPool(ActualPool, anim); } } }
public void ChangePage <TPage>(int poolIndex, ISliderAnimation anim) where TPage : Page, new() { Page page = null; bool isExist = false; bool other = poolIndex != ActualPool; bool poolContains = _pool.ContainsKey(poolIndex); bool hasSame = poolContains && _pool[poolIndex].Any(x => x.GetType() == typeof(TPage)); if (other) { ActualPool = poolIndex; if (hasSame) { page = _pool[poolIndex].FirstOrDefault(x => x.GetType() == typeof(TPage)); isExist = true; } } if (!_poolHistory.Contains(poolIndex)) { _poolHistory.Add(poolIndex); } if (!isExist) { page = new TPage(); if (!poolContains) { _pool.Add(poolIndex, new List <Page>()); } _pool[poolIndex].Add(page); } OnChangePage(page, anim); }
public void OnChangePage <TPage>(TPage target, ISliderAnimation anim) where TPage : Page, new() { PageChanged?.Invoke(target, anim); }
public void ChangePage <TPage>(int poolIndex, ISliderAnimation anim) where TPage : Page, new() { TPage page = AddToHistory <TPage>(poolIndex); OnChangePage(page, anim); }
public void ChangeToLastByActualPool(ISliderAnimation animation = null) { var target = _pool[ActualPool].Last(); OnChangePage(target, animation); }
public void ChangePage <TPage>(ISliderAnimation anim) where TPage : Page, new() { var page = new TPage(); OnChangePage(page, anim); }
public void SetupNext <TPage>(ISliderAnimation animation) where TPage : Page, new() { nextInvoker = pool => ChangePage <TPage>(pool, animation); }
protected override void OnPageChanged(Page page, ISliderAnimation sliderAnimation) { _loginPage = page.GetType() == typeof(Pages.LoginPage); _regPage = page.GetType() == typeof(Pages.UserRegPage) || page.GetType() == typeof(Pages.ProfilePage); _parksPage = page.GetType() == typeof(Pages.ParkingsPage); }