Beispiel #1
0
 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 LatestChapterTap(object param)
        {
            if (param == null)
            {
                return;
            }

            MangaAbstractModel model = (MangaAbstractModel)param;

            OnSelectChapter(model);

            NavigationService.Navigate("/ViewMangaPage.xaml");
        }
Beispiel #3
0
        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;
        }
Beispiel #4
0
        public void ClearImagesFromExpiredChapters()
        {
            try
            {
                IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();

                if (App.AppData.ChaptersInSeries != null && App.AppData.ChaptersInSeries.Count > 0)
                {
                    MangaAbstractModel firstItem = App.AppData.ChaptersInSeries[0];

                    string[]      files         = store.GetFileNames(firstItem.SeriesId + "_*.img");
                    List <string> validMangaIds = new List <string>(App.AppData.ChaptersInSeries.Count);
                    foreach (MangaAbstractModel viewModel in App.AppData.ChaptersInSeries)
                    {
                        validMangaIds.Add(viewModel.MangaId);
                    }

                    foreach (string fileName in files)
                    {
                        if (!fileName.EndsWith(".img") || !fileName.StartsWith(firstItem.SeriesId))
                        {
                            continue;
                        }

                        int    start   = fileName.IndexOf("_") + 1;
                        int    end     = fileName.IndexOf("_", start);
                        string mangaId = fileName.Substring(start, end - start);

                        if (!validMangaIds.Contains(mangaId))
                        {
                            store.DeleteFile(fileName);
                        }
                    }
                }
            }
            catch
            {
            }
        }
Beispiel #5
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();
            }
        }
        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);
            }
        }
Beispiel #7
0
 public void StopViewingChapter()
 {
     _currentlyViewingChapter = null;
 }