Exemplo n.º 1
0
        public async Task <bool> LoadNavigationState(string id, IFrameFacade frame)
        {
            // get state
            var folder = ApplicationData.Current.LocalCacheFolder;
            var file   = await folder.TryGetItemAsync(buildKey(id)) as StorageFile;

            if (file == null)
            {
                return(false);
            }

            // test date
            var setting = App.Settings.SuspensionStateExpires;
            var expires = DateTime.Now.Subtract(setting);
            var info    = await file.GetBasicPropertiesAsync();

            var expired = expires <= info.DateModified;

            if (expired)
            {
                return(false);
            }

            // set state
            var state = await FileIO.ReadTextAsync(file);

            frame.SetNavigationState(state);
            return(true);
        }
Exemplo n.º 2
0
        public async Task<bool> LoadNavigationState(string id, IFrameFacade frame)
        {
            // get state
            var folder = ApplicationData.Current.LocalCacheFolder;
            var file = await folder.TryGetItemAsync(buildKey(id)) as StorageFile;
            if (file == null)
            {
                return false;
            }

            // test date
            var setting = App.Settings.SuspensionStateExpires;
            var expires = DateTime.Now.Subtract(setting);
            var info = await file.GetBasicPropertiesAsync();
            var expired = expires <= info.DateModified;
            if (expired)
            {
                return false;
            }

            // set state
            var state = await FileIO.ReadTextAsync(file);
            frame.SetNavigationState(state);
            return true;
        }
Exemplo n.º 3
0
        private void RestoreFrameNavigationState(IFrameFacade frame)
        {
            var frameState = GetSessionStateForFrame(frame);

            if (frameState.ContainsKey("Navigation"))
            {
                frame.SetNavigationState((String)frameState["Navigation"]);
            }
        }
Exemplo n.º 4
0
        private void RestoreFrameNavigationState(IFrameFacade frame)
        {
            var frameState = GetSessionStateForFrame(frame);

            if (frameState.ContainsKey(Constants.SessionStateKeyNavigation))
            {
                frame.SetNavigationState((string)frameState[Constants.SessionStateKeyNavigation]);
            }
        }
 /// <summary>
 /// Clears the navigation history.
 /// </summary>
 public void ClearHistory()
 {
     _frame.SetNavigationState("1,0");
 }
 private void RestoreFrameNavigationState(IFrameFacade frame)
 {
     var frameState = GetSessionStateForFrame(frame);
     if (frameState.ContainsKey("Navigation"))
     {
         frame.SetNavigationState((String)frameState["Navigation"]);
     }
 }
Exemplo n.º 7
0
 private void RestoreFrameNavigationState(IFrameFacade frame)
 {
     var frameState = GetSessionStateForFrame(frame);
     if (frameState.ContainsKey(Constants.SessionStateKeyNavigation))
     {
         frame.SetNavigationState((string)frameState[Constants.SessionStateKeyNavigation]);
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// Restore the navigation with the navigation state.
 /// </summary>
 /// <param name="navigationState">The navigation state</param>
 public void SetNavigationState(string navigationState)
 {
     frameFacade.SetNavigationState(navigationState);
 }