Alexandria.Common.SuspensionManager.RegisterFrame C# (CSharp) Метод

RegisterFrame() публичный статический Метод

Registers a Frame instance to allow its navigation history to be saved to and restored from SessionState. Frames should be registered once immediately after creation if they will participate in session state management. Upon registration if state has already been restored for the specified key the navigation history will immediately be restored. Subsequent invocations of RestoreAsync will also restore navigation history.
public static RegisterFrame ( Frame frame, String sessionStateKey ) : void
frame Windows.UI.Xaml.Controls.Frame An instance whose navigation history should be managed by ///
sessionStateKey String A unique key into used to /// store navigation-related information.
Результат void
        public static void RegisterFrame(Frame frame, String sessionStateKey)
        {
            if (frame.GetValue(FrameSessionStateKeyProperty) != null)
            {
                throw new InvalidOperationException("Frames can only be registered to one session state key");
            }

            if (frame.GetValue(FrameSessionStateProperty) != null)
            {
                throw new InvalidOperationException("Frames must be either be registered before accessing frame session state, or not registered at all");
            }

            // Use a dependency property to associate the session key with a frame, and keep a list of frames whose
            // navigation state should be managed
            frame.SetValue(FrameSessionStateKeyProperty, sessionStateKey);
            _registeredFrames.Add(new WeakReference<Frame>(frame));

            // Check to see if navigation state can be restored
            RestoreFrameNavigationState(frame);
        }