Exemplo n.º 1
0
 private void NavigationEventHub_Navigated(object sender, NavigationEventArgs e)
 {
     _detailsViewModel = ControlsHelper.FindResource <DownloadDetailsViewModel>("Details");
     if (_detailsViewModel != null && e.ExtraContent is HqDownloadInfo extraContent)
     {
         _detailsViewModel.DownloadInfo = extraContent;
         _hqStatus.Entry = new HqEntry {
             ReadStatus = "Add to..."
         };
         if (_detailsViewModel.DownloadInfo.Hq != null && !string.IsNullOrEmpty(_detailsViewModel.DownloadInfo.Hq.Link))
         {
             _hqStatus.Entry = _entryManager.GetHqEntry(_detailsViewModel.DownloadInfo.Hq);
             _hqStatus.Hq    = _detailsViewModel.DownloadInfo.Hq;
             if (_userContext.ReaderHistory.Find().Where(x => x.Link == _hqStatus.Hq.Link).Execute() is List <ReaderHistory> list)
             {
                 var listM = new List <ReaderHistory>();
                 foreach (var item in list)
                 {
                     item.Reader.Hq            = _detailsViewModel.DownloadInfo.Hq;
                     item.Reader.ActualChapter = _hqStatus.Hq.Chapters[item.Reader.ActualChapterIndex];
                     listM.Add(item);
                 }
                 _detailsViewModel.Readings = listM.Reverse <ReaderHistory>().ToList();
             }
         }
     }
 }
        public override void OnLoaded(object sender, RoutedEventArgs e)
        {
            base.OnLoaded(sender, e);
            _sourceLibraries = ControlsHelper.FindResource <SourceLibraryViewModel>("Libraries");

            ShowLibrary();
        }
Exemplo n.º 3
0
 public virtual void OnLoaded(object sender, RoutedEventArgs e)
 {
     _list                      = ControlsHelper.Find <System.Windows.Controls.ListView>("DownloadInfoChapters");
     _notification              = ControlsHelper.FindResource <NotificationViewModel>("Notification");
     _editModel                 = ControlsHelper.FindResource <EditDownloadViewModel>("Edit");
     _hqStatus                  = ControlsHelper.FindResource <HqStatusViewModel>("HqStatus");
     _hqStatus.PropertyChanged += HqStatusChanged;
 }
 public virtual void OnLoaded(object sender, RoutedEventArgs e)
 {
     _notification   = ControlsHelper.FindResource <NotificationViewModel>("Notification");
     _pageTitleView  = ControlsHelper.FindResource <NavigationViewModel>("NavigationView");
     _readerView     = ControlsHelper.Find <System.Windows.Controls.ListView>("FlipViewReader");
     _scroolOfReader = _readerView.Find <ScrollViewer>().FirstOrDefault();
     _scroolOfReader.ScrollChanged += ScroolViwer_ViewChanged;
 }
Exemplo n.º 5
0
 public void OnLoaded(object sender, RoutedEventArgs e)
 {
     _configurationViewModel = ControlsHelper.FindResource <ConfigurationViewModel>("Configuration");
     if (_configurationContext.Configuration.FindOne("1") is Configuration config)
     {
         config.DownloadLocations = _configurationContext.DownloadLocation.FindAll();
         _configurationViewModel.Configuartion = config;
     }
 }
 public virtual void OnLoaded(object sender, RoutedEventArgs e)
 {
     _notification                  = ControlsHelper.FindResource <NotificationViewModel>("Notification");
     _sourceSelector                = ControlsHelper.FindResource <HqSourceLibrarySelectorViewModel>("SourceSelector");
     _detailsViewModel              = ControlsHelper.FindResource <DetailsViewModel>("DetailsView");
     _hqStatusView                  = ControlsHelper.FindResource <HqStatusViewModel>("HqStatus");
     _hqStatusView.PropertyChanged += HqStatusChanged;
     _sources      = _sourceManager.GetSources();
     _actualSource = _sources[_sourceSelector.SelectedSource];
     _sourceSelector.PropertyChanged += SelectedSourceChanged;
 }
Exemplo n.º 7
0
        public virtual void OnLoaded(object sender, RoutedEventArgs e)
        {
            _notification            = ControlsHelper.FindResource <NotificationViewModel>("Notification");
            _libraryViewModel        = ControlsHelper.FindResource <MyLibraryViewModel>("MyLibrary");
            _notification.Visibility = true;

            Task <List <HqDownloadInfo> > .Factory.StartNew(() => {
                return(_downloadManager.GetDownloadedHqsInfo());
            }).ContinueWith((list) => {
                Dispatcher.Invoke(() => {
                    _libraryViewModel.DownloadInfos = new ObservableCollection <HqDownloadInfo>(list.Result);
                    _notification.Visibility        = false;
                });
            });
        }
Exemplo n.º 8
0
        public virtual void OnLoaded(object sender, RoutedEventArgs e)
        {
            _downloadListViewModel = ControlsHelper.FindResource <DownloadListViewModel>("DownloadListView");
            _downloadList          = ControlsHelper.Find <ListView>("DownloadList");
            _chapterList           = ControlsHelper.Find <ListView>("HqChapters");

            DownloadEventHub.DownloadStart        += OnDownloadStart;
            DownloadEventHub.DownloadEnd          += OnDonwloadEnd;
            DownloadEventHub.DownloadChapterStart += OnDownloadChapterStart;
            DownloadEventHub.DownloadChapterEnd   += OnDownloadChapterEnd;;
            DownloadEventHub.DownloadProgress     += OnDownloadProgress;

            Task.Run(() => {
                var downloadList = _downloadManager.GetDownloadList();
                Dispatcher.Invoke(() => {
                    _downloadListViewModel.DownloadList = downloadList;
                });
            });
        }
        private void NavigationEventHub_Navigated(object sender, NavigationEventArgs e)
        {
            _readerViewModel = ControlsHelper.FindResource <ReaderViewModel>("ReaderControl");
            var collection = ControlsHelper.FindResource <CollectionViewSource>("Reader");

            if (e.ExtraContent != null && _readerViewModel != null)
            {
                var reader = e.ExtraContent as ReaderViewModel;
                _readerViewModel.Hq = reader.Hq;
                collection.Source   = _readerViewModel.Hq.Chapters;
                _collectionView     = collection?.View;
                _collectionView.MoveCurrentToPosition(reader.ActualChapterIndex);
                _readerViewModel.ActualChapter      = reader.ActualChapter;
                _readerViewModel.ActualChapterIndex = reader.ActualChapterIndex;
                _readerViewModel.PreviousChapter    = reader.PreviousChapter;
                _readerViewModel.ActualPage         = reader.ActualPage;
                _readerViewModel.NextChapter        = reader.NextChapter;
                LoadChapter();
            }
        }
Exemplo n.º 10
0
 public override void OnLoaded(object sender, RoutedEventArgs e)
 {
     base.OnLoaded(sender, e);
     _sourceUpdate = ControlsHelper.FindResource <SourceUpdateViewModel>("Updates");
     ShowUpdates();
 }