Esempio n. 1
0
        public async Task <Article> ReadArticleAsync(string id, string category)
        {
            _presentSlideShowIndex = 1;
            _presentSlideShowCount = 1;
            _slideShowDetails      = null;

            Article tempArticle = new Article();

            try
            {
                DispatcherHelper.UIDispatcher.BeginInvoke(() => { IsFetchingArticle = true; });
                Article temp = await _dataService.GetArticlesFromId(id, category);

                if (temp != null)
                {
                    tempArticle = Article = await _dataService.ReadArticleAsync(temp);

                    NextArticle     = _dataService.GetNextArticle();
                    PreviousArticle = _dataService.GetPreviousArticle();
                    SaveArticleCommand.RaiseCanExecuteChanged();
                }
                else
                {
                    return(null);
                }
                DispatcherHelper.UIDispatcher.BeginInvoke(() => { IsFetchingArticle = false; });
            }
            catch (Exception)
            { }
            return(tempArticle);
        }
Esempio n. 2
0
        public async Task <Article> ReadArticleAsync(string id, string category)
        {
            var tempArticle = new Article();

            try
            {
                DispatcherHelper.UIDispatcher.BeginInvoke(() => { IsFetchingArticle = true; });
                var temp = await _dataService.GetArticlesFromId(id, category);

                if (temp != null)
                {
                    tempArticle = Article = await _dataService.ReadArticleAsync(temp);

                    NextArticle     = _dataService.GetNextArticle();
                    PreviousArticle = _dataService.GetPreviousArticle();
                    SaveArticleCommand.RaiseCanExecuteChanged();
                }
                else
                {
                    return(null);
                }
                DispatcherHelper.UIDispatcher.BeginInvoke(() => { IsFetchingArticle = false; });
            }
            catch (Exception exception)
            {
                if (Debugger.IsAttached)
                {
                    Debug.WriteLine("ArticleViewModel:" + exception);
                }
            }
            return(tempArticle);
        }
Esempio n. 3
0
        private async void SaveArticle()
        {
            await _dataService.SaveCurrentArticleAsync(Article);

            SaveArticleCommand.RaiseCanExecuteChanged();
        }
Esempio n. 4
0
 private void DataServiceOnSavedArticleChanged(object sender, ArticleChangedEventArgs articleChangedEventArgs)
 {
     SaveArticleCommand.RaiseCanExecuteChanged();
 }