Ejemplo n.º 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.ToString());
            state.Write <object>("CurrentPageParam", CurrentPageParam);
            state.Write <string>("NavigateState", FrameFacadeInternal?.GetNavigationState());
            await Task.CompletedTask;
        }
Ejemplo n.º 2
0
        public void SaveNavigation()
        {
            var state = State(GetType());

            state["CurrentPageType"]  = CurrentPageType.ToString();
            state["CurrentPageParam"] = CurrentPageParam;
            state["NavigateState"]    = _frame.GetNavigationState();
        }
Ejemplo n.º 3
0
        public void SaveNavigation()
        {
            var state = FrameFacade.PageStateContainer(GetType());

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

            state["CurrentPageType"]  = CurrentPageType?.ToString();
            state["CurrentPageParam"] = CurrentPageParam;
            state["NavigateState"]    = FrameFacade?.GetNavigationState();
        }
Ejemplo n.º 4
0
        public void SaveNavigation()
        {
            var state = FrameFacade.PageStateContainer(GetType());

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

            state["CurrentPageType"] = CurrentPageType.ToString();
            try { state["CurrentPageParam"] = CurrentPageParam; }
            catch
            {
                throw new Exception("Failed to serialize page parameter, override/implement ToString()");
            }
            state["NavigateState"] = FrameFacade?.GetNavigationState();
        }
        /// <summary>
        /// Save the navigation state.
        /// </summary>
        public void SaveNavigation()
        {
            // it is possible to close the application before we have navigated and created state
            if (CurrentPageType == null)
            {
                return;
            }

            var state = FrameFacade.GetPageStateContainer(GetType());

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

            state[CURRENT_PAGE_TYPE_KEY] = CurrentPageType.ToString();
            try { state[CURRENT_PAGE_PARAM_KEY] = CurrentPageParam; }
            catch
            {
                throw new Exception("Failed to serialize page parameter, override/implement ToString()");
            }
            state[NAVIGATE_STATE_KEY] = FrameFacade?.GetNavigationState();
        }