Exemplo n.º 1
0
        public void SaveNavigation()
        {
            DebugWrite($"Frame: {FrameFacade.FrameId}");

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

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

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

            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", FrameFacade?.GetNavigationState());
        }
Exemplo n.º 2
0
        bool RaiseBeforeSavingNavigation()
        {
            var args = new CancelEventArgs <Type>(CurrentPageType);

            BeforeSavingNavigation?.Invoke(this, args);
            return(args.Cancel);
        }
Exemplo n.º 3
0
        void INavigationService2.RaiseBeforeSavingNavigation(out bool cancel)
        {
            var args = new CancelEventArgsEx <Type>(CurrentPageType);

            BeforeSavingNavigation?.Invoke(this, args);
            cancel = args.Cancel;
        }
Exemplo n.º 4
0
        public async Task SaveAsync()
        {
            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?.NavigationService.NavigationState);

            await Task.CompletedTask;
        }
Exemplo n.º 5
0
        public void SaveNavigation()
        {
            if (CurrentPageType == null)
            {
                return;
            }
            var args = new CancelEventArgs <Type>(FrameFacade.CurrentPageType);

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

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

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

            state["CurrentPageType"]  = CurrentPageType.AssemblyQualifiedName;
            state["CurrentPageParam"] = ParameterSerializationService.Instance.SerializeParameter(CurrentPageParam);
            state["NavigateState"]    = FrameFacade?.GetNavigationState();
        }