Example #1
0
        protected override async Task Archive(ReaderItem item)
        {
            await CacheService.DeleteArticle(item);

            Items.Remove(item);
            await CacheService.SaveLocalItems(Items);
        }
Example #2
0
        private async Task SaveItemFromExternal(UriSchemeMessage message, Action errorAction = null)
        {
            HomeButtonIsVisible = true;
            var        allOk = true;
            ReaderItem item  = null;

            try
            {
                IsSavingVisible = true;

                item = await _readerHelper.HandleProtocolMessage(message);
            }
            catch (Exception ex)
            {
                Log.ErrorException("ShareMessage", ex);
                allOk = false;
            }

            if (item != null)
            {
                await SetReaderItem(item, autostart : false);
            }

            IsSavingVisible = false;


            if (allOk && _canStart)
            {
                StartStopTimer();
            }
            else
            {
                errorAction?.Invoke();
            }
        }
Example #3
0
        protected override async Task <ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return(null);
            }

            if (!isRefresh)
            {
                var article = await CacheService.GetArticle(item);

                if (article != null)
                {
                    return(article);
                }
            }

            var text = await GetArticleText(item.Id);

            var result = new ReaderItem();

            item.CopyItem(result);
            result.Text       = text.StripHtmlTags();
            item.Text         = result.Text.ToExcerpt();
            item.IsDownloaded = !string.IsNullOrEmpty(result.Text);
            await CacheService.SaveArticle(result).ConfigureAwait(false);

            return(result);
        }
        protected override async Task <ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return(null);
            }

            if (!isRefresh)
            {
                var article = await CacheService.GetArticle(item);

                if (article != null)
                {
                    return(article);
                }
            }

            var response = await _readabilityClient.GetArticleAsync(item.Id);

            if (response != null)
            {
                var article = response.ToReaderItem();
                item.IsDownloaded = !string.IsNullOrEmpty(article.Text);
                await CacheService.SaveArticle(article).ConfigureAwait(false);

                return(article);
            }

            return(null);
        }
        protected override async Task Archive(ReaderItem item)
        {
            if (!AuthenticationService.IsLoggedIntoReadability)
            {
                return;
            }
            var id     = int.Parse(item.Id);
            var failed = false;

            try
            {
                await _readabilityClient.SetBookmarkArchiveStateAsync(id, true);
            }
            catch (Exception ex)
            {
                Log.ErrorException("ArchiveArticle", ex);
                failed = true;
            }

            if (!failed)
            {
                var itemToRemove = Items.FirstOrDefault(x => x.Id == item.Id);
                if (itemToRemove != null)
                {
                    Items.Remove(itemToRemove);
                }

                CacheService.SaveReadabilityItems(Items).ConfigureAwait(false);

                await CacheService.DeleteArticle(item);
            }
        }
Example #6
0
        protected override async Task Archive(ReaderItem item)
        {
            if (!AuthenticationService.IsLoggedInToPocket)
            {
                return;
            }
            var failed = false;

            try
            {
                if (!await _pocketClient.Archive(item.Id))
                {
                    failed = true;
                }
            }
            catch (Exception ex)
            {
                Log.ErrorException("PocketArchiveMessage", ex);
                failed = true;
            }

            if (!failed)
            {
                var itemToDelete = Items.FirstOrDefault(x => x.Id == item.Id);
                if (itemToDelete == null)
                {
                    return;
                }

                Items.Remove(itemToDelete);
                CacheService.SavePocketItems(Items).ConfigureAwait(false);

                await CacheService.DeleteArticle(item);
            }
        }
        protected override async Task<ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return null;
            }

            if (!isRefresh)
            {
                var article = await CacheService.GetArticle(item);
                if (article != null)
                {
                    return article;
                }
            }

            var text = await GetArticleText(item.Id);
            var result = new ReaderItem();
            item.CopyItem(result);
            result.Text = text.StripHtmlTags();
            item.Text = result.Text.ToExcerpt();
            item.IsDownloaded = !string.IsNullOrEmpty(result.Text);
            await CacheService.SaveArticle(result).ConfigureAwait(false);

            return result;
        }
Example #8
0
        public async Task DeleteArticle(ReaderItem item)
        {
            var filename = GetFileName(item.InternalId);

            if (await _storage.Local.FileExistsAsync(filename))
            {
                await _storage.Local.DeleteFileAsync(filename);
            }
        }
Example #9
0
        protected override async Task<ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return null;
            }

            var article = await CacheService.GetArticle(item);

            return article;
        }
Example #10
0
        protected override async Task <ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return(null);
            }

            var article = await CacheService.GetArticle(item);

            return(article);
        }
        protected virtual async Task FullPage(ReaderItem item)
        {
            var article = await GetArticle(item);

            if (article == null)
            {
                return;
            }

            FullPageViewModel.ReaderItem = article;
            NavigationService.Navigate <FullPageView>();
        }
Example #12
0
        public async Task SaveArticle(ReaderItem item)
        {
            var filename = GetFileName(item.InternalId);

            using (var file = await _storage.Local.CreateFileAsync(filename))
            {
                using (var writer = new BinaryWriter(file))
                {
                    writer.Write(item);
                }
            }
        }
        protected virtual async Task Reader(ReaderItem item)
        {
            var article = await GetArticle(item);

            if (article == null)
            {
                return;
            }

            ReaderViewModel.SetReaderItem(article);
            NavigationService.Navigate <ReaderView>();
        }
Example #14
0
        private async Task Save(Action navigationAction = null)
        {
            var text = _loader.GetString("Saving.Text");
            SetProgressBar(text);

            var copyItem = new ReaderItem();
            ReaderItem.CopyItem(copyItem);
            await _readerHelper.SaveEditedArticle(copyItem);

            SetProgressBar();

            navigationAction?.Invoke();
        }
Example #15
0
        private async Task Save(Action navigationAction = null)
        {
            var text = _loader.GetString("Saving.Text");

            SetProgressBar(text);

            var copyItem = new ReaderItem();

            ReaderItem.CopyItem(copyItem);
            await _readerHelper.SaveEditedArticle(copyItem);

            SetProgressBar();

            navigationAction?.Invoke();
        }
        public static ReaderItem ToReaderItem(this Bookmark article)
        {
            var result = new ReaderItem
            {
                Id = article.Id.ToString(),
                Source = SourceProvider.Instapaper,
                Author = string.Empty,
                Title = article.Title ?? string.Empty,
                Url = article.Url ?? string.Empty,
                Excerpt = article.Description ?? string.Empty,
                Text= string.Empty,
                CreatedDate = article.Time ?? DateTime.Now
            };

            return result;
        }
        public static ReaderItem ToReaderItem(this Bookmark article)
        {
            var result = new ReaderItem
            {
                Id          = article.Id.ToString(),
                Source      = SourceProvider.Instapaper,
                Author      = string.Empty,
                Title       = article.Title ?? string.Empty,
                Url         = article.Url ?? string.Empty,
                Excerpt     = article.Description ?? string.Empty,
                Text        = string.Empty,
                CreatedDate = article.Time ?? DateTime.Now
            };

            return(result);
        }
        public static ReaderItem ToReaderItem(this PocketArticle article)
        {
            var result = new ReaderItem
            {
                Id = article.ID ?? string.Empty,
                Source= SourceProvider.Pocket,
                Author = article.Authors == null ? string.Empty : string.Join(", ", article.Authors) ?? string.Empty,
                Title = article.Title ?? string.Empty,
                Url = article.Uri.AbsoluteUri ?? string.Empty,
                Excerpt = string.Empty,
                Text = article.Content.StripHtmlTags() ?? string.Empty,
                CreatedDate = article.PublishedTime ?? DateTime.Now
            };

            result.WordCount = string.IsNullOrEmpty(result.Text) ? 0 : result.Text.Split(new[] {' '}).Length;
            return result;
        }
        public static ReaderItem ToReaderItem(this PocketArticle article)
        {
            var result = new ReaderItem
            {
                Id          = article.ID ?? string.Empty,
                Source      = SourceProvider.Pocket,
                Author      = article.Authors == null ? string.Empty : string.Join(", ", article.Authors) ?? string.Empty,
                Title       = article.Title ?? string.Empty,
                Url         = article.Uri.AbsoluteUri ?? string.Empty,
                Excerpt     = string.Empty,
                Text        = article.Content.StripHtmlTags() ?? string.Empty,
                CreatedDate = article.PublishedTime ?? DateTime.Now
            };

            result.WordCount = string.IsNullOrEmpty(result.Text) ? 0 : result.Text.Split(new[] { ' ' }).Length;
            return(result);
        }
        public static ReaderItem ToReaderItem(this Article article)
        {
            var result = new ReaderItem
            {
                Id = article.Id ?? string.Empty,
                Source = SourceProvider.Readability,
                Author = article.Author ?? string.Empty,
                Title = article.Title ?? string.Empty,
                Url = article.Url ?? string.Empty,
                Excerpt = article.Excerpt ?? string.Empty,
                WordCount = article.WordCount,
                CreatedDate = article.DatePublished ?? DateTime.Now,
                Text = string.IsNullOrEmpty(article.Content) ? string.Empty : article.Content.StripHtmlTags()
            };

            return result;
        }
        public static ReaderItem ToReaderItem(this ExtendedPocketItem article)
        {
            var result = new ReaderItem
            {
                Id          = article.ResolvedId ?? string.Empty,
                Source      = SourceProvider.Pocket,
                Author      = article.Authors == null ? string.Empty : string.Join(", ", article.Authors) ?? string.Empty,
                Title       = article.DisplayTitle ?? string.Empty,
                Text        = string.Empty,
                Url         = article.Uri.ToString() ?? string.Empty,
                Excerpt     = article.Excerpt ?? string.Empty,
                CreatedDate = article.UpdateTime ?? DateTime.Now
            };

            result.WordCount = string.IsNullOrEmpty(result.Text) ? 0 : result.Text.Split(new[] { ' ' }).Length;
            return(result);
        }
        public static ReaderItem ToReaderItem(this ExtendedPocketItem article)
        {
            var result = new ReaderItem
            {
                Id = article.ResolvedId ?? string.Empty,
                Source = SourceProvider.Pocket,
                Author = article.Authors == null ? string.Empty : string.Join(", ", article.Authors) ?? string.Empty,
                Title = article.DisplayTitle ?? string.Empty,
                Text = string.Empty,
                Url = article.Uri.ToString() ?? string.Empty,
                Excerpt = article.Excerpt ?? string.Empty,
                CreatedDate = article.UpdateTime ?? DateTime.Now
            };

            result.WordCount = string.IsNullOrEmpty(result.Text) ? 0 : result.Text.Split(new[] { ' ' }).Length;
            return result;
        }
        public static ReaderItem ToReaderItem(this Article article)
        {
            var result = new ReaderItem
            {
                Id          = article.Id ?? string.Empty,
                Source      = SourceProvider.Readability,
                Author      = article.Author ?? string.Empty,
                Title       = article.Title ?? string.Empty,
                Url         = article.Url ?? string.Empty,
                Excerpt     = article.Excerpt ?? string.Empty,
                WordCount   = article.WordCount,
                CreatedDate = article.DatePublished ?? DateTime.Now,
                Text        = string.IsNullOrEmpty(article.Content) ? string.Empty : article.Content.StripHtmlTags()
            };

            return(result);
        }
Example #24
0
        private ReaderItem CopyReaderItem(int?wordsRead = null)
        {
            var readerItem = new ReaderItem();

            SelectedItem.CopyItem(readerItem);
            if (wordsRead.HasValue)
            {
                readerItem.WordsRead = wordsRead.Value;
            }

            if (string.IsNullOrEmpty(readerItem.Excerpt))
            {
                readerItem.Excerpt = readerItem.Text.ToExcerpt();
            }

            readerItem.Text = string.Empty;
            return(readerItem);
        }
Example #25
0
        public async Task <ReaderItem> GetArticle(ReaderItem item)
        {
            var filename = GetFileName(item.InternalId);

            if (!await _storage.Local.FileExistsAsync(filename))
            {
                return(null);
            }

            using (var file = await _storage.Local.OpenFileForReadAsync(filename))
            {
                using (var reader = new BinaryReader(file))
                {
                    var cachedItem = reader.ReadGeneric <ReaderItem>();
                    return(cachedItem);
                }
            }
        }
Example #26
0
        public async Task SetReaderItem(ReaderItem item, bool isRestarting = false, bool autostart = true)
        {
            ReaderFont   = _settingsService.ReaderFont;
            SelectedItem = item;
            GetInProgressItems().ConfigureAwait(false);
            AddToRecent().ConfigureAwait(false);
            IsPaused = false;
            if (!isRestarting)
            {
                _canStart = false;
            }

            WordsList      = null;
            TimeRemaining  = null;
            _readerTimer   = null;
            WordsPerMinute = _settingsService.WordsPerMin;
            SelectedIndex  = -1;
            SetProgressBar("Preparing article...");

            SelectedItem.WordsRead = GetWordsRead();

            var words = item.Text.Clean().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            if (_settingsService.WordsAtATime == 1)
            {
                WordsList = words.ToList();
                SetTimings();
                SetProgressBar();
            }
            else
            {
                var list = words.ToWordList(_settingsService.WordsAtATime);
                WordsList = list;
                SetTimings();
                SetProgressBar();
            }

            if (_canStart && autostart)
            {
                StartStopTimer();
                return;
            }
            _canStart = true;
        }
Example #27
0
        protected override async Task Archive(ReaderItem item)
        {
            if (!AuthenticationService.IsLoggedIntoInstapaper)
            {
                return;
            }
            var id     = int.Parse(item.Id);
            var failed = false;

            try
            {
                var archivedItem = await _instapaperClient.ArchiveBookmarkAsync(id);

                if (archivedItem == null || archivedItem.Response == null)
                {
                    failed = true;
                }
            }
            catch (Exception ex)
            {
                Log.ErrorException("ArchiveArticle", ex);
                failed = true;
            }

            if (!failed)
            {
                var itemToRemove = Items.FirstOrDefault(x => x.Id == item.Id);
                if (itemToRemove == null)
                {
                    return;
                }

                Items.Remove(itemToRemove);

                CacheService.SaveInstapaperItems(Items).ConfigureAwait(false);

                await CacheService.DeleteArticle(item);
            }
        }
Example #28
0
        public async Task SaveEditedArticle(ReaderItem copyItem)
        {
            var response = await _cacheService.GetLocalItemsFromCache();

            var isAdd = false;

            var existingItem = response.ReaderItems.FirstOrDefault(x => x.Id == copyItem.Id);

            if (existingItem == null)
            {
                isAdd         = true;
                copyItem.Text = copyItem.Text.Clean();
                var title = copyItem.Text.Length > 150 ? copyItem.Text.Substring(0, 150).Trim() : copyItem.Text;
                copyItem.Title       = title;
                copyItem.CreatedDate = DateTime.Now;
                copyItem.Url         = copyItem.Author = string.Empty;

                existingItem = copyItem;
            }
            else
            {
                existingItem.Text = copyItem.Text.Clean();
            }

            existingItem.Excerpt   = copyItem.Text.ToExcerpt();
            existingItem.WordCount = copyItem.Text.Split(' ').Length;

            await _cacheService.SaveArticle(existingItem);

            existingItem.Text = string.Empty;

            if (isAdd)
            {
                response.ReaderItems.Insert(0, existingItem);
            }

            await _cacheService.SaveLocalItems(response.ReaderItems);
        }
Example #29
0
        public async Task <ReaderItem> HandleProtocolMessage(UriSchemeMessage m)
        {
            if (m.IsUri)
            {
                var item = await SaveArticle(new Uri(m.Content));

                if (item != null)
                {
                    var fullItem = await _cacheService.GetArticle(item);

                    return(fullItem);
                }
            }
            else
            {
                var item = ReaderItem.NewLocalItem(m.Content);
                await SaveEditedArticle(item);

                return(item);
            }

            return(null);
        }
Example #30
0
        protected override async Task <ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return(null);
            }

            if (!isRefresh)
            {
                var article = await CacheService.GetArticle(item);

                if (article != null)
                {
                    return(article);
                }
            }

            try
            {
                var response = await _pocketClient.GetArticle(new Uri(item.Url, UriKind.Absolute), forceRefresh : isRefresh);

                if (response != null)
                {
                    var article = response.ToReaderItem();
                    item.IsDownloaded = true;
                    await CacheService.SaveArticle(article).ConfigureAwait(false);

                    return(article);
                }
            }
            catch (Exception ex)
            {
                Log.ErrorException("GetArticle", ex);
            }

            return(null);
        }
Example #31
0
        public async Task SaveEditedArticle(ReaderItem copyItem)
        {
            var response = await _cacheService.GetLocalItemsFromCache();
            var isAdd = false;

            var existingItem = response.ReaderItems.FirstOrDefault(x => x.Id == copyItem.Id);
            if (existingItem == null)
            {
                isAdd = true;
                copyItem.Text = copyItem.Text.Clean();
                var title = copyItem.Text.Length > 150 ? copyItem.Text.Substring(0, 150).Trim() : copyItem.Text;
                copyItem.Title = title;
                copyItem.CreatedDate = DateTime.Now;
                copyItem.Url = copyItem.Author = string.Empty;

                existingItem = copyItem;
            }
            else
            {
                existingItem.Text = copyItem.Text.Clean();
            }

            existingItem.Excerpt = copyItem.Text.ToExcerpt();
            existingItem.WordCount = copyItem.Text.Split(' ').Length;

            await _cacheService.SaveArticle(existingItem);

            existingItem.Text = string.Empty;

            if (isAdd)
            {
                response.ReaderItems.Insert(0, existingItem);
            }

            await _cacheService.SaveLocalItems(response.ReaderItems);
        }
Example #32
0
        private ReaderItem CopyReaderItem(int? wordsRead = null)
        {
            var readerItem = new ReaderItem();
            SelectedItem.CopyItem(readerItem);
            if (wordsRead.HasValue)
            {
                readerItem.WordsRead = wordsRead.Value;
            }

            if (string.IsNullOrEmpty(readerItem.Excerpt))
            {
                readerItem.Excerpt = readerItem.Text.ToExcerpt();
            }

            readerItem.Text = string.Empty;
            return readerItem;
        }
Example #33
0
        public async Task SetReaderItem(ReaderItem item, bool isRestarting = false, bool autostart = true)
        {
            ReaderFont = _settingsService.ReaderFont;
            SelectedItem = item;
            GetInProgressItems().ConfigureAwait(false);
            AddToRecent().ConfigureAwait(false);
            IsPaused = false;
            if (!isRestarting)
            {
                _canStart = false;
            }

            WordsList = null;
            TimeRemaining = null;
            _readerTimer = null;
            WordsPerMinute = _settingsService.WordsPerMin;
            SelectedIndex = -1;
            SetProgressBar("Preparing article...");

            SelectedItem.WordsRead = GetWordsRead();

            var words = item.Text.Clean().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            if (_settingsService.WordsAtATime == 1)
            {
                WordsList = words.ToList();
                SetTimings();
                SetProgressBar();
            }
            else
            {
                var list = words.ToWordList(_settingsService.WordsAtATime);
                WordsList = list;
                SetTimings();
                SetProgressBar();
            }

            if (_canStart && autostart)
            {
                StartStopTimer();
                return;
            }
            _canStart = true;
        }
Example #34
0
 public async Task SaveEditedArticle(ReaderItem copyItem)
 {
 }
        protected override async Task Archive(ReaderItem item)
        {
            if (!AuthenticationService.IsLoggedIntoInstapaper) return;
            var id = int.Parse(item.Id);
            var failed = false;

            try
            {
                var archivedItem = await _instapaperClient.ArchiveBookmarkAsync(id);
                if (archivedItem == null || archivedItem.Response == null)
                {
                    failed = true;
                }
            }
            catch (Exception ex)
            {
                Log.ErrorException("ArchiveArticle", ex);
                failed = true;
            }

            if (!failed)
            {
                var itemToRemove = Items.FirstOrDefault(x => x.Id == item.Id);
                if (itemToRemove == null) return;

                Items.Remove(itemToRemove);

                CacheService.SaveInstapaperItems(Items).ConfigureAwait(false);

                await CacheService.DeleteArticle(item);
            }
        }
 protected virtual Task<ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
 {
     return null;
 }
 protected virtual Task <ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
 {
     return(null);
 }
        protected override async Task<ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return null;
            }

            if (!isRefresh)
            {
                var article = await CacheService.GetArticle(item);
                if (article != null)
                {
                    return article;
                }
            }

            var response = await _readabilityClient.GetArticleAsync(item.Id);
            if (response != null)
            {
                var article = response.ToReaderItem();
                item.IsDownloaded = !string.IsNullOrEmpty(article.Text);
                await CacheService.SaveArticle(article).ConfigureAwait(false);
                return article;
            }

            return null;
        }
        protected virtual async Task Reader(ReaderItem item)
        {
            var article = await GetArticle(item);
            if (article == null)
            {
                return;
            }

            ReaderViewModel.SetReaderItem(article);
            NavigationService.Navigate<ReaderView>();
        }
Example #40
0
        public async Task DeleteArticle(ReaderItem item)
        {
            var filename = GetFileName(item.InternalId);

            if (await _storage.Local.FileExistsAsync(filename))
            {
                await _storage.Local.DeleteFileAsync(filename);
            }
        }
 public Task<ReaderItem> GetArticle(ReaderItem item)
 {
     throw new NotImplementedException();
 }
Example #42
0
 public Task DeleteArticle(ReaderItem item)
 {
     throw new NotImplementedException();
 }
Example #43
0
        protected override async Task<ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return null;
            }

            if (!isRefresh)
            {
                var article = await CacheService.GetArticle(item);
                if (article != null)
                {
                    return article;
                }
            }

            try
            {
                var response = await _pocketClient.GetArticle(new Uri(item.Url, UriKind.Absolute), forceRefresh: isRefresh);
                if (response != null)
                {
                    var article = response.ToReaderItem();
                    item.IsDownloaded = true;
                    await CacheService.SaveArticle(article).ConfigureAwait(false);
                    return article;
                }
            }
            catch (Exception ex)
            {
                Log.ErrorException("GetArticle", ex);
            }

            return null;
        }
Example #44
0
 protected override async Task Archive(ReaderItem item)
 {
     await CacheService.DeleteArticle(item);
     Items.Remove(item);
     await CacheService.SaveLocalItems(Items);
 }
Example #45
0
        protected override async Task Archive(ReaderItem item)
        {
            if (!AuthenticationService.IsLoggedInToPocket) return;
            var failed = false;
            try
            {
                if (!await _pocketClient.Archive(item.Id))
                {
                    failed = true;
                }
            }
            catch (Exception ex)
            {
                Log.ErrorException("PocketArchiveMessage", ex);
                failed = true;
            }

            if (!failed)
            {
                var itemToDelete = Items.FirstOrDefault(x => x.Id == item.Id);
                if (itemToDelete == null) return;

                Items.Remove(itemToDelete);
                CacheService.SavePocketItems(Items).ConfigureAwait(false);

                await CacheService.DeleteArticle(item);
            }
        }
        protected override async Task Archive(ReaderItem item)
        {
            if (!AuthenticationService.IsLoggedIntoReadability) return;
            var id = int.Parse(item.Id);
            var failed = false;

            try
            {
                await _readabilityClient.SetBookmarkArchiveStateAsync(id, true);
            }
            catch (Exception ex)
            {
                Log.ErrorException("ArchiveArticle", ex);
                failed = true;
            }

            if (!failed)
            {
                var itemToRemove = Items.FirstOrDefault(x => x.Id == item.Id);
                if (itemToRemove != null)
                {
                    Items.Remove(itemToRemove);
                }

                CacheService.SaveReadabilityItems(Items).ConfigureAwait(false);

                await CacheService.DeleteArticle(item);
            }
        }
 protected virtual Task Archive(ReaderItem item)
 {
     return null;
 }
Example #48
0
        public async Task SaveArticle(ReaderItem item)
        {
            var filename = GetFileName(item.InternalId);

            using (var file = await _storage.Local.CreateFileAsync(filename))
            {
                using (var writer = new BinaryWriter(file))
                {
                    writer.Write(item);
                }
            }
        }
        protected virtual async Task FullPage(ReaderItem item)
        {
            var article = await GetArticle(item);
            if (article == null)
            {
                return;
            }

            FullPageViewModel.ReaderItem = article;
            NavigationService.Navigate<FullPageView>();
        }
Example #50
0
        public async Task<ReaderItem> GetArticle(ReaderItem item)
        {
            var filename = GetFileName(item.InternalId);
            if (!await _storage.Local.FileExistsAsync(filename))
            {
                return null;
            }

            using (var file = await _storage.Local.OpenFileForReadAsync(filename))
            {
                using (var reader = new BinaryReader(file))
                {
                    var cachedItem = reader.ReadGeneric<ReaderItem>();
                    return cachedItem;
                }
            }
        }
Example #51
0
 public ArchiveMessage(SourceProvider source, ReaderItem item, Action action)
 {
     SourceProvider = source;
     Item = item;
     Action = action;
 }
Example #52
0
 public ArchiveMessage(SourceProvider source, ReaderItem item, Action action)
 {
     SourceProvider = source;
     Item           = item;
     Action         = action;
 }
 public Task DeleteArticle(ReaderItem item)
 {
     throw new NotImplementedException();
 }
Example #54
0
 public Task <ReaderItem> GetArticle(ReaderItem item)
 {
     throw new NotImplementedException();
 }
 protected virtual Task Archive(ReaderItem item)
 {
     return(null);
 }
 public async Task SaveEditedArticle(ReaderItem copyItem)
 {
 }