Beispiel #1
0
 /// <summary>
 /// Go back in navigation history
 /// </summary>
 public void GoBack()
 {
     if (_frame.CanGoBack)
     {
         _frame.GoBack();
     }
 }
        public bool RequestClose(IMvxViewModel toClose)
        {
            return(RequestMainThreadAction(() =>
            {
                var topMost = _rootFrame.Content;
                if (topMost == null)
                {
                    MvxTrace.Trace(MvxTraceLevel.Warning, "Don't know how to close this viewmodel - no current content");
                    return;
                }

                var viewTopMost = topMost as IMvxView;
                if (viewTopMost == null)
                {
                    MvxTrace.Trace(MvxTraceLevel.Warning, "Don't know how to close this viewmodel - current content is not a view");
                    return;
                }

                var viewModel = viewTopMost.ReflectionGetViewModel();
                if (viewModel != toClose)
                {
                    MvxTrace.Trace(MvxTraceLevel.Warning, "Don't know how to close this viewmodel - viewmodel is not topmost");
                    return;
                }

                if (!_rootFrame.CanGoBack)
                {
                    MvxTrace.Trace(MvxTraceLevel.Warning, "Can't close - can't go back");
                    return;
                }

                _rootFrame.GoBack();
            }));
        }
 public void GoBack()
 {
     if (EnsureMainFrame())
     {
         _mainFrame.GoBack();
     }
 }
Beispiel #4
0
        void PageTransitionDetails_Completed(object sender, EventArgs e)
        {
            // Reset root frame to MainPage.xaml
            PhoneApplicationFrame root = (PhoneApplicationFrame)Application.Current.RootVisual;

            root.GoBack();
        }
Beispiel #5
0
 public void GoBack()
 {
     if (EnsureMainFrame() && _mainFrame.CanGoBack)
     {
         _mainFrame.GoBack();
     }
 }
Beispiel #6
0
        public void Execute(object parameter)
        {
            UserToken User = parameter as UserToken;

            if (User != null)
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    MessageBoxResult Result;
                    Result = MessageBox.Show(String.Format(Resources.AskAccountDelete, User.ScreenName), "", MessageBoxButton.OKCancel);
                    if (Result == MessageBoxResult.OK)
                    {
                        // Make a copy: removing while iterating causes an error.
                        var copy = new List <TwitterResource>(Config.Columns.Where(item => item.User == User));
                        foreach (var item in copy)
                        {
                            Config.Columns.Remove(item);
                        }

                        Config.SaveColumns();
                        Config.Accounts.Remove(User);
                        Config.SaveAccounts();
                        PhoneApplicationFrame service = ((PhoneApplicationFrame)Application.Current.RootVisual);
                        if (service.CanGoBack)
                        {
                            service.GoBack();
                        }
                    }
                });
            }
        }
 public void GoBack()
 {
     if (EnsureMainFrame() && _mainFrame.CanGoBack && _mainFrame.BackStack.Count() > 0)
     {
         _mainFrame.GoBack();
     }
 }
Beispiel #8
0
        public virtual IObservable <bool> Close(IReactiveViewModel viewModel)
        {
            IViewFor currentView = frame.Content as IViewFor;

            if (currentView == null)
            {
                this.Log().Info("Frame has no page. Ignore close for viewmodel {0}.", viewModel);
                return(Observable.Return(false));
            }

            if (currentView.ViewModel != viewModel)
            {
                this.Log().Info("The current page does not correspond to the closing viewmodel. Ignore close for viewmodel {0}.", viewModel);
                return(Observable.Return(false));
            }

            if (!frame.CanGoBack)
            {
                this.Log().Info("The frame can not go back. Ignore close for viewmodel {0}.", viewModel);
                return(Observable.Return(false));
            }

            frame.GoBack();
            return(Observable.Return(true));
        }
Beispiel #9
0
 public void GoBack()
 {
     if (this.CanGoBack)
     {
         _mainFrame.GoBack();
     }
 }
        /// <summary>
        /// This is corresponding to PhoneApplicationPage.NavigatedTo()
        /// entering a page
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NonLinearNavigationService_Navigated(object sender, NavigationEventArgs e)
        {
            //Debug.WriteLine("in NonLinearNavigationService_Navigating - Navigated to " + e.Uri);
            //Debug.WriteLine("--------------------");

            switch (_NavHelper.NavMode)
            {
            case NavigationMode.Back:
                // remove previous page from stack
                _History.Remove(_NavHelper.CurrentUri);

                // if in recursive back mode automatic nav back
                if (IsRecursiveBackNavigation == true)
                {
                    if (_LoopStartTargetPageUri != e.Uri)
                    {
                        _AppRootFrame.GoBack();
                    }
                    else
                    {
                        EndRecursiveBackNavigation();
                        _LastCanceleddUri = null;
                    }
                }

                break;

            case NavigationMode.New:
                if (!_NavHelper.TargetUri.ToString().Equals("app://external/") &&
                    !_History.Contains(_NavHelper.TargetUri))
                {
                    _History.Add(_NavHelper.TargetUri);
                }

                break;


            case NavigationMode.Forward:
                break;

            case NavigationMode.Refresh:
                break;

            default:
                break;
            }
        }
 public void GoBack()
 {
     if (EnsureMainFrame() && _mainFrame.CanGoBack)
     {
         Trace.Info(Category, String.Format("Go back from {0}", _mainFrame.CurrentSource));
         _mainFrame.GoBack();
     }
 }
 /// <summary>
 /// Goes back.
 /// </summary>
 public void GoBack()
 {
     this.CheckRootFrame();
     if (!isNavigatingNow && rootFame.CanGoBack)
     {
         rootFame.GoBack();
     }
 }
Beispiel #13
0
        public void GoBack()
        {
            EnsurePhotoApplicationFrame();

            if (_phoneApplicationFrame.CanGoBack)
            {
                _phoneApplicationFrame.GoBack();
            }
        }
        private void GoBack()
        {
            PhoneApplicationFrame rootFrame = Application.Current.RootVisual as PhoneApplicationFrame;

            if (rootFrame.CanGoBack)
            {
                rootFrame.GoBack();
            }
        }
Beispiel #15
0
        public void NavigateBack()
        {
            PhoneApplicationFrame rootFrame = Application.Current.RootVisual as PhoneApplicationFrame;

            if (rootFrame.CanGoBack)
            {
                rootFrame.GoBack();
            }
        }
Beispiel #16
0
        public void GoBack()
        {
            PhoneApplicationFrame root = Application.Current.RootVisual as PhoneApplicationFrame;

            if (root != null && root.CanGoBack)
            {
                root.GoBack();
            }
        }
 public void GoBack()
 {
     if (EnsureMainFrame() && _mainFrame.CanGoBack)
     {
         DispatcherHelper.UIDispatcher.BeginInvoke(() =>
         {
             _mainFrame.GoBack();
         });
     }
 }
Beispiel #18
0
        public static void GoBack()
        {
            PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;

            if (frame == null)
            {
                return;
            }

            frame.GoBack();
        }
Beispiel #19
0
        private async Task NavigateBackWithAliveRequest()
        {
            var wentBackTask = Observable.FromEventPattern <NavigatedEventHandler, NavigationEventArgs>(h => _frame.Navigated += h, h => _frame.Navigated -= h)
                               .SubscribeOn(_dispatcherScheduler)
                               .Where(args => args.EventArgs.NavigationMode == NavigationMode.Back)
                               .Take(1)
                               .ToTask();
            await _dispatcherScheduler.Run(() => _frame.GoBack());

            await wentBackTask;
        }
Beispiel #20
0
        public void NavigateBack(object navigationContext)
        {
            this._navigationContext = navigationContext;
            PhoneApplicationFrame rootFrame = Application.Current.RootVisual as PhoneApplicationFrame;

            rootFrame.Navigated += rootFrame_Navigated;

            if (rootFrame.CanGoBack)
            {
                rootFrame.GoBack();
            }
        }
Beispiel #21
0
        private void OnBackKeyPress(object sender, CancelEventArgs e)
        {
            if (NavigateBackInterceptor != null)
            {
                NavigateBackInterceptor(this, e);
                if (e.Cancel)
                {
                    return;
                }
            }

            if (_rootFrame.CanGoBack)
            {
                _rootFrame.GoBack();
            }
        }
Beispiel #22
0
        public void GoBack()
        {
            if (!Deployment.Current.CheckAccess())
            {
                var context = new DispatcherSynchronizationContext(Deployment.Current.Dispatcher);
                context.Send(_ => GoBack(), null);
                return;
            }

            PhoneApplicationFrame root = Application.Current.RootVisual as PhoneApplicationFrame;

            Debug.Assert(root != null, "Root is null");
            if (root.CanGoBack)
            {
                root.GoBack();
            }
        }
Beispiel #23
0
        /// <summary>
        /// Permet de revenir en arriére dans la pile de navigation des pages
        /// </summary>
        private bool SetGoBack(Type historyViewModel)
        {
            //Sauvegarde de l'état actuel pour revenir en arriére si il le faut
#if WINDOWS_PHONE
            var        navigationSave = _rootFrame.CurrentSource;
            System.Uri navigationState;
#else
            var    navigationSave = _rootFrame.GetNavigationState();
            string navigationState;
#endif

            //Chargement de l'état voulu
            if (_historyNavigation.ContainsKey(historyViewModel))
            {
                if (_historyNavigation.TryGetValue(historyViewModel, out navigationState))
                {
#if WINDOWS_PHONE
                    _rootFrame.GoBack();
#else
                    _rootFrame.SetNavigationState(navigationState);
#endif
                }

#if WINDOWS_PHONE
                //TODO: Voir comment assurer une vérification de la cohérence de page
#else
                //Vérification de la bonne cohérence
                Type historyType;
                var  currentType = _rootFrame.CurrentSourcePageType;
                var  result      = _viewsRegister.TryGetValue(historyViewModel, out historyType);
                if (result)
                {
                    if (currentType != historyType)
                    {
                        //On reprend la position précédente car le type de page dans la Frame
                        //ne correspond pas à celui vers lequel on doit revenir
                        _rootFrame.SetNavigationState(navigationSave);
                        return(false);
                    }
                }
#endif
            }
            return(true);
        }
            private void RunNavigateBack()
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    // Tries to navigate according to the job.
                    // Exceptions are caught and reported but ignored.
                    try
                    {
                        _rootFrame.GoBack();
                    }
                    catch (Exception ex)
                    {
                        // We're not navigating anymore.
                        IsNavigating = false;

                        // Reports the exception.
                        Utils.DebugUtils.DumpException(ex, "Error on Navigation request, handled.", dumpOnBugSenseToo: true);
                    }
                });
            }
        public void RequestClose(IMvxViewModel viewModel)
        {
            var topPage = _frame.Content;
            var view    = topPage as IMvxView;

            if (view == null)
            {
                MvxTrace.Trace("request close ignored for {0} - no current view", viewModel.GetType().Name);
                return;
            }

            if (view.ViewModel != viewModel)
            {
                MvxTrace.Trace("request close ignored for {0} - current view is registered for a different viewmodel of type {1}", viewModel.GetType().Name, view.ViewModel.GetType().Name);
                return;
            }

            MvxTrace.Trace("request close for {0} - will close current page {1}", viewModel.GetType().Name, view.GetType().Name);
            _frame.GoBack();
        }
Beispiel #26
0
        public virtual void Close(IMvxViewModel viewModel)
        {
            var currentView = _rootFrame.Content as IMvxView;

            if (currentView == null)
            {
                Mvx.Warning("Ignoring close for viewmodel - rootframe has no current page");
                return;
            }

            if (currentView.ViewModel != viewModel)
            {
                Mvx.Warning("Ignoring close for viewmodel - rootframe's current page is not the view for the requested viewmodel");
                return;
            }

            if (!_rootFrame.CanGoBack)
            {
                Mvx.Warning("Ignoring close for viewmodel - rootframe refuses to go back");
                return;
            }

            _rootFrame.GoBack();
        }
Beispiel #27
0
 public override void GoBack()
 {
     _service.GoBack();
 }
 public bool RequestNavigateBack()
 {
     return(InvokeOrBeginInvoke(() => _rootFrame.GoBack()));
 }
Beispiel #29
0
 public void GoBack()
 {
     _rootFrame.GoBack();
 }
Beispiel #30
0
 /// <summary>
 /// Goes the back.
 /// </summary>
 public void GoBack()
 {
     _frame.GoBack();
 }