public AppData() { this.LatestChapters = new ObservableCollection<MangaAbstractModel>(); this.Series = new SeriesByName(new List<SeriesModel>()); this.ChaptersInSeries = new ObservableCollection<MangaAbstractModel>(); this._currentlyViewingSeries = null; this._currentlyViewingChapter = null; this._currentlyViewingPage = -1; this._downloadAllContext = 0; this._downloadAllProgress = new Dictionary<uint, uint>(); this._downloadPageContext = 0; this._downloadPageProgress = new Dictionary<uint, uint>(); _backgroundTransfer = new BackgroundTransfer(); _mangaDB = new MangaDataContext(Constants._DBConnectionString); if (!_mangaDB.DatabaseExists()) { _mangaDB.CreateDatabase(); } }
public void OnSelectChapter(MangaAbstractModel viewModel) { if (App.AppData.CurrentSeries != null && viewModel.SeriesId.Equals(App.AppData.CurrentSeries.SeriesId)) { App.AppData.ViewChapter(viewModel); } else { MessageBox.Show("Unable to find " + viewModel.SeriesName); } }
public void ViewChapter(MangaAbstractModel viewModel) { var query = from MangaModel manga in _mangaDB.Manga where manga.MangaId == viewModel.MangaId select manga; List<MangaModel> mangaModels = new List<MangaModel>(query); if (mangaModels.Count > 0) { UpdateManga(mangaModels); IsChapterLoaded = (Manga != null) && IsCreationTimeFresh(mangaModels[0].CreationTime, _oneWeekRetention); } else { Manga = null; IsChapterLoaded = false; } _currentlyViewingChapter = viewModel; }
public void StopViewingChapter() { _currentlyViewingChapter = null; }
public void OnSelectChapter(MangaAbstractModel viewModel) { bool found = false; foreach (SeriesInGroup group in Series) { foreach (SeriesModel series in group) { if (series.SeriesId.Equals(viewModel.SeriesId)) { App.AppData.ViewSeries(series); found = true; } } } if (found) { App.AppData.ViewChapter(viewModel); } else { MessageBox.Show("Unable to find " + viewModel.SeriesName); } }