Пример #1
0
        public static int CompareBySeriesName(object obj1, object obj2)
        {
            SeriesModel manga1 = (SeriesModel)obj1;
            SeriesModel manga2 = (SeriesModel)obj2;

            return(manga1.SeriesName.CompareTo(manga2.SeriesName));
        }
Пример #2
0
        public static string GetSeriesNameKey(SeriesModel viewModel)
        {
            char key = char.ToLower(viewModel.SeriesName[0]);

            if (key < 'a' || key > 'z')
            {
                key = '#';
            }

            return(key.ToString());
        }
Пример #3
0
        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);
            }
        }
Пример #4
0
        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();
            }
        }
Пример #5
0
        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;
        }
Пример #6
0
 public void StopViewingSeries()
 {
     _currentlyViewingSeries = null;
 }
Пример #7
0
 public void OnSelectSeries(SeriesModel viewModel)
 {
     App.AppData.ViewSeries(viewModel);
 }
Пример #8
0
        public static string GetSeriesNameKey(SeriesModel viewModel)
        {
            char key = char.ToLower(viewModel.SeriesName[0]);

            if (key < 'a' || key > 'z')
            {
                key = '#';
            }

            return key.ToString();
        }