ArcGISPortalViewer.Common.SuspensionManager.RestoreAsync C# (CSharp) Method

RestoreAsync() public static method

Restores previously saved SessionState. Any Frame instances registered with RegisterFrame will also restore their prior navigation state, which in turn gives their active Page an opportunity restore its state.
public static RestoreAsync ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task
        public static async Task RestoreAsync()
        {
            _sessionState = new Dictionary<String, Object>();

            // Get the input stream for the SessionState file
            StorageFile file = await ApplicationData.Current.LocalFolder.GetFileAsync(sessionStateFilename);
            using (IInputStream inStream = await file.OpenSequentialReadAsync())
            {
                // Deserialize the Session State
                DataContractSerializer serializer = new DataContractSerializer(typeof(Dictionary<string, object>), _knownTypes);
                _sessionState = (Dictionary<string, object>)serializer.ReadObject(inStream.AsStreamForRead());
            }

            // Restore any registered frames to their saved state
            foreach (var weakFrameReference in _registeredFrames)
            {
                Frame frame;
                if (weakFrameReference.TryGetTarget(out frame))
                {
                    frame.ClearValue(FrameSessionStateProperty);
                    RestoreFrameNavigationState(frame);
                }
            }
        }