コード例 #1
0
        /// <summary>
        /// Called when parameters change.
        /// </summary>
        /// <returns>The asynchronous test.</returns>
        protected override async Task OnParametersSetAsync()
        {
            if (Uid != lastUid)
            {
                lastUid = Uid;
                await LoadingService.WrapExecutionAsync(
                    async() =>
                    History =
                    await DocumentService.LoadDocumentHistoryAsync(lastUid));
            }

            await base.OnParametersSetAsync();
        }
コード例 #2
0
        /// <summary>
        /// Called when the <see cref="Document"/> identifier is set.
        /// </summary>
        /// <returns>An asynchronous task.</returns>
        protected override async Task OnParametersSetAsync()
        {
            var newUid = WebUtility.UrlDecode(Uid);

            if (newUid != uid)
            {
                var history = string.Empty;
                var query   = NavigationHelper.GetQueryString(
                    NavigationService.Uri);
                if (query.ContainsKey(nameof(history)))
                {
                    history = query[nameof(history)];
                }

                Loading  = false;
                NotFound = false;
                uid      = newUid;
                try
                {
                    Loading = true;
                    if (string.IsNullOrWhiteSpace(history))
                    {
                        await LoadingService.WrapExecutionAsync(
                            async() => Document = await
                            DocumentService.LoadDocumentAsync(uid));

                        NotFound = Document == null;
                        Audit    = false;
                    }
                    else
                    {
                        await LoadingService.WrapExecutionAsync(
                            async() => Document = await
                            DocumentService.LoadDocumentSnapshotAsync(Guid.Parse(history), uid));

                        Audit    = true;
                        NotFound = Document == null;
                    }

                    Loading = false;
                    await TitleService.SetTitleAsync($"Viewing {Title}");
                }
                catch
                {
                    NotFound = true;
                }
            }

            await base.OnParametersSetAsync();
        }