コード例 #1
0
        public static async Task <NavigationStack> DeserializeAsync()
        {
            NavigationStack result = new NavigationStack();

            if (!await FileHelper.IsLocalFileExistsAsync("callstack.data", false))
            {
                return(result);
            }
            var localFile = await FileHelper.GetLocalFileAsync("callstack.data", false);

            using (var fileStream = await localFile.OpenReadAsync())
            {
                using (var reader = new DataReader(fileStream))
                {
                    reader.InputStreamOptions = InputStreamOptions.ReadAhead;

                    await reader.LoadAsync((uint)fileStream.Size);

                    var stacksCount = reader.ReadInt32();
                    for (var index = 0; index < stacksCount; index++)
                    {
                        result.StatesStack.Add(StackData.Deserialize(reader));
                    }
                }
            }

            return(result);
        }
コード例 #2
0
ファイル: Shell.xaml.cs プロジェクト: mvegaca/Podcasts
        public async Task <bool> DeserializeAsync()
        {
            try
            {
                navigationStack = await NavigationStack.DeserializeAsync();

                return(navigationStack.StatesStack.Count != 0);
            }
            catch
            {
                return(false);
            }
        }