示例#1
0
        public void OnNavigatedTo(MtNavigationEventArgs e)
        {
            if (PageKey != null) // new instance
            {
                return;
            }

            var frameState = MtSuspensionManager.SessionStateForFrame(_page.Frame);

            PageKey = "Page" + _page.Frame.BackStackDepth;

            if (e.NavigationMode == NavigationMode.New)
            {
                var nextPageKey   = PageKey;
                var nextPageIndex = _page.Frame.BackStackDepth;
                while (frameState.Remove(nextPageKey))
                {
                    nextPageIndex++;
                    nextPageKey = "Page" + nextPageIndex;
                }

                // Does not make sense when no page state is available...
                //var args = new MtLoadStateEventArgs(e.Parameter, null);

                //var copy = LoadState;
                //if (copy != null)
                //    copy(this, args);

                _page.LoadState(e.Parameter, null);
                //_page.OnLoadState(args);
            }
            else
            {
                var pageState = (Dictionary <String, Object>)frameState[PageKey];
                var args      = new MtLoadStateEventArgs(e.Parameter, pageState);

                var copy = LoadState;
                if (copy != null)
                {
                    copy(this, args);
                }

                _page.LoadState(e.Parameter, pageState);
                _page.OnLoadState(args);
            }
        }
示例#2
0
        public void OnNavigatedTo(MtNavigationEventArgs e)
        {
            if (!_stateLoaded)
            {
                var frameState = MtSuspensionManager.SessionStateForFrame(_page.Frame);

                if (e.NavigationMode == NavigationMode.New)
                {
                    var nextPageKey = PageKey;
                    var nextPageIndex = _page.Frame.BackStackDepth;
                    while (frameState.Remove(nextPageKey))
                    {
                        nextPageIndex++;
                        nextPageKey = "Page" + nextPageIndex;
                    }

                    // Does not make sense when no page state is available...
                    //var args = new MtLoadStateEventArgs(e.Parameter, null);

                    //var copy = LoadState;
                    //if (copy != null)
                    //    copy(this, args);

                    _page.LoadState(e.Parameter, null);
                    //_page.OnLoadState(args);
                }
                else
                {
                    var pageState = (Dictionary<String, Object>)frameState[PageKey];
                    var args = new MtLoadStateEventArgs(e.Parameter, pageState);

                    var copy = LoadState;
                    if (copy != null)
                        copy(this, args);

                    _page.LoadState(e.Parameter, pageState);
                    _page.OnLoadState(args);
                }

                _stateLoaded = true; 
            }
        }
示例#3
0
 /// <summary>Used to load the saved state when the page has been reactivated. </summary>
 /// <param name="pageState">The saved page state. </param>
 public void OnLoadState(MtLoadStateEventArgs pageState)
 {
     // TODO: Load the view model state.
 }
示例#4
0
 protected override void OnLoadState(MtLoadStateEventArgs pageState)
 {
     Model.Filter = pageState.Get <string>("Filter");
 }
示例#5
0
 protected override void OnLoadState(MtLoadStateEventArgs pageState)
 {
     MyTextBox.Text = pageState.Get<string>("MyTextBox");
 }
示例#6
0
 /// <summary>Used to load the saved state when the page has been reactivated. </summary>
 /// <param name="pageState">The saved page state. </param>
 protected internal virtual void OnLoadState(MtLoadStateEventArgs pageState)
 {
     // Must be empty
 }
示例#7
0
 protected override void OnLoadState(MtLoadStateEventArgs pageState)
 {
     MyTextBox.Text = pageState.Get <string>("MyTextBox");
 }
示例#8
0
 /// <summary>Used to load the saved state when the page has been reactivated. </summary>
 /// <param name="pageState">The saved page state. </param>
 public void OnLoadState(MtLoadStateEventArgs pageState)
 {
     // TODO: Load the view model state. 
 }
 /// <summary>Used to load the saved state when the page has been reactivated. </summary>
 /// <param name="pageState">The saved page state. </param>
 public void OnLoadState(MtLoadStateEventArgs pageState)
 {
     SampleProperty = pageState.Get <string>("SampleProperty");
 }
示例#10
0
 protected override void OnLoadState(MtLoadStateEventArgs pageState)
 {
     Model.Filter = pageState.Get<string>("Filter");
 }
示例#11
0
 /// <summary>Used to load the saved state when the page has been reactivated. </summary>
 /// <param name="pageState">The saved page state. </param>
 public void OnLoadState(MtLoadStateEventArgs pageState)
 {
     SampleProperty = pageState.Get<string>("SampleProperty");
 }