Пример #1
0
        private void DynamicViewHost_OnSetAsCurrentView(DynamicViewBase dynamicView, NavigationDirections navigationDirection)
        {
            _newView          = dynamicView;
            _newViewDirection = navigationDirection;

            CurrentDynamicView.OnFadeOutComplete -= _currentDynamicView_OnFadeOutComplete;

            _currentDynamicView_OnFadeOutComplete = () =>
            {
                var oldDV = CurrentDynamicView.GetHashCode();
                var newDV = dynamicView.GetHashCode();

                dynamicView.SetDirection(navigationDirection);
                CurrentDynamicView = dynamicView;

                if (oldDV == newDV)
                {
                    CurrentDynamicView.FadeIn();
                }
            };


            CurrentDynamicView.OnFadeOutComplete += _currentDynamicView_OnFadeOutComplete;
            //CurrentDynamicView.OnFadeOutComplete += CurrentDynamicView_OnFadeOutComplete;

            CurrentDynamicView.SetDirection(navigationDirection);

            CurrentDynamicView.FadeOut();
        }
Пример #2
0
        private DynamicViewBase GetRootView(DynamicViewBase view)
        {
            if (view.DynamicViewParent is DynamicViewBase dvb)
            {
                return(GetRootView(dvb));
            }

            return(view);
        }
Пример #3
0
        private void CurrentDynamicView_OnFadeOutComplete()
        {
            var oldDV = CurrentDynamicView.GetHashCode();

            _newView.SetDirection(_newViewDirection);
            CurrentDynamicView.OnFadeOutComplete -= CurrentDynamicView_OnFadeOutComplete;
            CurrentDynamicView = _newView;

            if (oldDV == _newView.GetHashCode())
            {
                CurrentDynamicView.FadeIn();
            }

            _newView = null;
        }
Пример #4
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            for (int i = 0; i < DynamicViews.Count; i++)
            {
                var view = DynamicViews[i].GetView(CurrentDynamicViewName);

                if (view != null)
                {
                    CurrentDynamicView         = view;
                    CurrentDynamicView.Opacity = 1;
                }
            }
        }
Пример #5
0
        private DynamicViewBase FindView(DynamicViewBase view, string name)
        {
            if (view.Name == name)
            {
                return(view);
            }

            for (int i = 0; i < view.Children?.Count; i++)
            {
                var cView = FindView(view.Children[i], name);

                if (cView != null)
                {
                    return(cView);
                }
            }

            return(null);
        }
Пример #6
0
 private void DynamicViewBase_OnSetAsCurrentView(DynamicViewBase dynamicView, DynamicViewHost.NavigationDirections navigationDirection)
 {
     OnSetAsCurrentView?.Invoke(dynamicView, navigationDirection);
 }