Example #1
0
        public async Task SaveNavigationAsync()
        {
            DebugWrite($"Frame: {FrameFacadeInternal.FrameId}");

            if (CurrentPageType == null)
            {
                return;
            }
            var args = new CancelEventArgs <Type>(FrameFacadeInternal.CurrentPageType);

            BeforeSavingNavigation?.Invoke(this, args);
            if (args.Cancel)
            {
                return;
            }

            var state = FrameFacadeInternal.PageStateSettingsService(GetType().ToString());

            if (state == null)
            {
                throw new InvalidOperationException("State container is unexpectedly null");
            }

            state.Write <string>("CurrentPageType", CurrentPageType.AssemblyQualifiedName);
            state.Write <object>("CurrentPageParam", CurrentPageParam);
            state.Write <string>("NavigateState", FrameFacadeInternal?.GetNavigationState());
            await Task.CompletedTask;
        }
Example #2
0
        public async Task SaveAsync()
        {
            // save navigation state into settings

            DebugWrite($"Frame: {FrameFacade.FrameId}");

            if (CurrentPageType == null)
            {
                return;
            }
            if (RaiseBeforeSavingNavigation())
            {
                return;
            }

            var frameState = Suspension.GetFrameState();

            if (frameState == null)
            {
                throw new InvalidOperationException("State container is unexpectedly null");
            }

            frameState.Write <string>("CurrentPageType", CurrentPageType.AssemblyQualifiedName);
            frameState.Write <object>("CurrentPageParam", CurrentPageParam);
            frameState.Write <string>("NavigateState", FrameFacadeInternal.GetNavigationState());

            await Task.CompletedTask;
        }
Example #3
0
 public async Task <bool> RefreshAsync()
 {
     return(await NavigationOrchestratorAsync(CurrentPageType, CurrentPageParam, NavigationMode.Refresh, () =>
     {
         Windows.ApplicationModel.Resources.Core.ResourceContext.GetForCurrentView().Reset();
         FrameFacadeInternal.SetNavigationState(FrameFacadeInternal.GetNavigationState());
         return true;
     }));
 }