Exemplo n.º 1
0
 public void OnChangePageByType <TPage, Type>(TPage target, AnimateTo animateTo) where TPage : Page, new()
 {
     if (_subs.ContainsKey(typeof(Type)))
     {
         _subs[typeof(Type)]?.Invoke(target, animateTo);
     }
 }
Exemplo n.º 2
0
 public void ChangeToLastByPool(int index, AnimateTo animateTo = AnimateTo.None)
 {
     if (_pool.ContainsKey(index) && _pool[index].Count > 0)
     {
         var target = _pool[index].Last();
         OnChangePage(target, animateTo);
     }
 }
Exemplo n.º 3
0
        public void ChangePageByType <TPage, Type>(int poolIndex, AnimateTo animateTo = AnimateTo.None, object dataCont = null) where TPage : Page, new()
        {
            var target = new TPage();

            if (dataCont != null)
            {
                target.DataContext = dataCont;
            }
            ChangePageByType <TPage, Type>(target, AnimateTo.None, poolIndex);
        }
Exemplo n.º 4
0
        public void ChangePageByType <TPage, Type>(TPage target, AnimateTo animateTo, int poolIndex) where TPage : Page, new()
        {
            OnChangePageByType <TPage, Type>(target, animateTo);

            if (!_pool.ContainsKey(poolIndex))
            {
                _pool.Add(poolIndex, new List <Page>());
            }
            _pool[poolIndex].Add(target);
        }
Exemplo n.º 5
0
        public void ChangePage <TPage>(AnimateTo animate = AnimateTo.None, object dataContext = null) where TPage : Page, new()
        {
            var page = new TPage();

            if (dataContext != null)
            {
                page.DataContext = dataContext;
            }
            OnChangePage(page, animate);
        }
Exemplo n.º 6
0
        public void Play(UIElement uI, AnimateTo animate, int Width)
        {
            int from = animate == AnimateTo.Left ? Width : -Width;

            uI.RenderTransform = new TranslateTransform(from, 0);
            uI.Opacity         = 1;

            DoubleAnimation anim = new DoubleAnimation(from, 0, TimeSpan.FromSeconds(0.5));

            anim.EasingFunction = new ElasticEase()
            {
                Oscillations = 0
            };
            uI.RenderTransform.BeginAnimation(TranslateTransform.XProperty, anim);
        }
Exemplo n.º 7
0
        void ToEmployee(bool?toLeft = null)
        {
            var page = new Pages.WorkerFormPage();

            page.DataContext = this;
            (page.Content as UIElement).Opacity = 0;

            AnimateTo animate = AnimateTo.None;

            if (toLeft.HasValue)
            {
                animate = toLeft.Value ? AnimateTo.Left : AnimateTo.Rigth;
            }

            PageChanged(page, animate);
        }
Exemplo n.º 8
0
        public void ChangePage <TPage>(int poolIndex, AnimateTo animate = AnimateTo.None, object dataContext = null) 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));
                    if (dataContext != null)
                    {
                        page.DataContext = dataContext;
                    }
                    isExist = true;
                }
            }

            if (!_poolHistory.Contains(poolIndex))
            {
                _poolHistory.Add(poolIndex);
            }


            if (!isExist)
            {
                page = new TPage();
                if (dataContext != null)
                {
                    page.DataContext = dataContext;
                }

                if (!poolContains)
                {
                    _pool.Add(poolIndex, new List <Page>());
                }
                _pool[poolIndex].Add(page);
            }

            OnChangePage(page, animate);
        }
Exemplo n.º 9
0
        async void PageChanged(Page page, AnimateTo animate)
        {
            if (CurrentPage != null)
            {
                await animationService.fadeOut(CurrentPage.Content as UIElement);
            }
            Employee = Employees[_currentEmployee];

            //animationService.SetStart(page.Content as UIElement, animate, 600);

            Angle = rand.Next(-15, 15);
            Console.WriteLine((CurrentPage?.Content as UIElement)?.Opacity);
            CurrentPage = page;

            if (animate != AnimateTo.None)
            {
                animationService.Play(CurrentPage.Content as UIElement, animate, 600);
            }
            else
            {
                await animationService.fadeIn(CurrentPage.Content as UIElement);
            }
        }
Exemplo n.º 10
0
 public void OnChangePage <TPage>(TPage target, AnimateTo animateTo) where TPage : Page, new()
 {
     PageChanged?.Invoke(target, animateTo);
     PagesBinder.CheckBind <TPage>();
 }
Exemplo n.º 11
0
        public void ChangeToLastByActualPool(AnimateTo animateTo = AnimateTo.None)
        {
            var target = _pool[ActualPool].Last();

            OnChangePage(target, animateTo);
        }
Exemplo n.º 12
0
        public void ChangePage(Type pageType, AnimateTo animate = AnimateTo.None)
        {
            var page = Activator.CreateInstance(pageType) as Page;

            OnChangePage(page, animate);
        }