public static int CompareBySeriesName(object obj1, object obj2) { SeriesModel manga1 = (SeriesModel)obj1; SeriesModel manga2 = (SeriesModel)obj2; return(manga1.SeriesName.CompareTo(manga2.SeriesName)); }
public static string GetSeriesNameKey(SeriesModel viewModel) { char key = char.ToLower(viewModel.SeriesName[0]); if (key < 'a' || key > 'z') { key = '#'; } return(key.ToString()); }
public SeriesByName(List <SeriesModel> series) { series.Sort(SeriesModel.CompareBySeriesName); Dictionary <string, SeriesInGroup> groups = new Dictionary <string, SeriesInGroup>(); foreach (char c in Groups) { SeriesInGroup group = new SeriesInGroup(c.ToString()); this.Add(group); groups[c.ToString()] = group; } foreach (SeriesModel viewModel in series) { groups[SeriesModel.GetSeriesNameKey(viewModel)].Add(viewModel); } }
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 ViewSeries(SeriesModel viewModel) { var query = from MangaAbstractModel chapter in _mangaDB.Chapters where chapter.SeriesId == viewModel.SeriesId && chapter.IsRecentChapter == false select chapter; List<MangaAbstractModel> chapters = new List<MangaAbstractModel>(query); if (chapters.Count > 0) { UpdateChaptersInSeries(chapters); IsChaptersInSeriesLoaded = (ChaptersInSeries.Count > 0) && IsCreationTimeFresh(chapters[0].CreationTime, _oneDayRetention); } else { ChaptersInSeries.Clear(); IsChaptersInSeriesLoaded = false; } _currentlyViewingSeries = viewModel; }
public void StopViewingSeries() { _currentlyViewingSeries = null; }
public void OnSelectSeries(SeriesModel viewModel) { App.AppData.ViewSeries(viewModel); }
public static string GetSeriesNameKey(SeriesModel viewModel) { char key = char.ToLower(viewModel.SeriesName[0]); if (key < 'a' || key > 'z') { key = '#'; } return key.ToString(); }