Exemplo n.º 1
0
        public async Task Load()
        {
            UpdateInProgress = true;
            PageTitle        = "Lade " + NavigationParameter.DokumentTitel;

            bool loadingSucceeded = false;

            if (NavigationParameter.Action == NavigationAction.LoadFromService)
            {
                string dokumentNummer = NavigationParameter.Command;
                var    result         = await Task.Run(() => ParallelLoadSynced(dokumentNummer));

                if (null != result)
                {
                    CurrentDocument  = result.Item1;
                    SourceHtml       = result.Item2;
                    loadingSucceeded = true;
                }
            }
            else if (NavigationParameter.Action == NavigationAction.LoadCachedDownload)
            {
                loadingSucceeded = await LoadFromCacheAsync();
            }

            if (!loadingSucceeded)
            {
                PageTitle = "Fehler: Laden fehlgeschlagen";

                CurrentDocument = null;
                Attachments     = null;
                SourceHtml      = null;
            }
            else
            {
                PageTitle   = CreateTitleFromDocument();
                Attachments = CurrentDocument.GetAttachments();
            }

            RaisePropertyChanged(CanAddDownloadPropertyName);
            UpdateInProgress = false;
        }