/// <summary> /// Call this method to save the navigation history along with session state locally. On failure, the Last Saved date is set to default (of the data type). /// </summary> /// <returns></returns> public static async Task SaveSessionState() { try { LastSessionSavedDate = default(DateTimeOffset); LastSessionOwner = null; PageStates.Add((_currentPage as IManageable).SaveState()); StorageFile navFile = await _folder.CreateFileAsync(NAV_FILE_NAME, CreationCollisionOption.ReplaceExisting); StorageFile stateFile = await _folder.CreateFileAsync(STATE_FILE_NAME, CreationCollisionOption.ReplaceExisting); bool result = true; result &= await StorageHelper.TryWriteAsync(navFile, RootFrame.GetNavigationState()); result &= await StorageHelper.TryWriteAsync(stateFile, PageStates); if (result == true) { LastSessionSavedDate = DateTimeOffset.UtcNow; LastSessionOwner = UserManager.CurrentUser.RegNo; } } catch { } }