Exemplo n.º 1
0
        private void OnClosed()
        {
            if (AwaitableContainer != null)
            {
                AwaitableContainer.SetResult(null);
            }
            else
            {
                this.Visibility = Visibility.Collapsed;
                var _parent = this.Parent as Grid;
                if (_parent != null)
                {
                    _parent.Children.Remove(this);
                }
            }

            if (_hideTask != null)
            {
                _hideTask.SetResult(true);
                _hideTask = null;
            }
            if (OnHided != null)
            {
                OnHided();
            }
        }
Exemplo n.º 2
0
        public static Task <object> Show(IControlAwait view, bool isCrossPage, bool isIgnoreBack, Action <AwaitableContainer> onOpened, Action <AwaitableContainer> onClosed, IBackContainerInterface page = null)
        {
            if (page == null)
            {
                page = Window.Current.Content  as IBackContainerInterface;
            }
            if (view == null)
            {
                return(Task.FromResult <object>(null));
            }
            var _container = new AwaitableContainer()
            {
                Content = view, IsCanCross = isCrossPage, IsIgnoreBack = isIgnoreBack
            };

            if (onOpened != null)
            {
                _container.OnOpened += onOpened;
            }
            if (onClosed != null)
            {
                _container.OnClosed += onClosed;
            }
            view.AwaitableContainer = _container;
            page.OpenBackAble(_container);
            return(_container.WaitDataAsync());
        }
Exemplo n.º 3
0
        public static async Task Show(IDrawerContent childView, double pRange = 315.0, bool isTapDismiss = false, Mode mode = Mode.Right)
        {
            TryCloseCurrent();

            MDrawer _view = new MDrawer(mode)
            {
                Content = childView, PRange = pRange, _isTapDismiss = isTapDismiss
            };

            childView.Drawer = _view;
            _current         = _view;
            await AwaitableContainer.Show(_view, false);

            if (childView is FrameworkElement)
            {
                (childView as FrameworkElement).DataContext = null;
            }
            if (_current == _view)
            {
                _current = null;
            }
            _view.Content    = null;
            childView.Drawer = null;
        }