Ejemplo n.º 1
0
        public IActionResult AddVideoInfo(VideoInfo videoInfo)
        {
            if (!ModelState.IsValid)
            {
                VideoInfo info = _dataService.GetVideoInfo(videoInfo.Id);

                // View Model used for the add screen
                VideoInfoViewModel model = new VideoInfoViewModel()
                {
                    VideoId          = info.VideoId,
                    ProfileId        = info.ProfileId,
                    UploadDate       = info.UploadDate,
                    VisibilityId     = info.VisibilityId,
                    Visibilities     = _dataService.GetVisibilities(),
                    Title            = info.Title,
                    Description      = info.Description,
                    ThumbnailPath    = info.ThumbnailPath,
                    IsUploadFinished = info.IsUploadFinished
                };

                return(View(model));
            }

            // Set the upload to finished before updating
            videoInfo.IsUploadFinished = true;

            _dataService.UpdateVideoInfo(videoInfo);

            return(RedirectToAction("Index", "Home"));
        }
        public async Task LoadAsync()
        {
            var series = this.Source;

            this.VideoCollection.AddRange(
                await Task.Run(() => VideoInfoViewModel.Create(series)));
        }
Ejemplo n.º 3
0
        public IActionResult EditVideoInfo(VideoInfo videoInfo)
        {
            if (!ModelState.IsValid)
            {
                VideoInfoViewModel model = new VideoInfoViewModel();

                VideoInfo info = _dataService.GetVideoInfo(videoInfo.Id);
                model.Id               = info.Id;
                model.Description      = info.Description;
                model.UploadDate       = info.UploadDate;
                model.ThumbnailPath    = info.ThumbnailPath;
                model.ProfileId        = info.ProfileId;
                model.Profile          = info.Profile;
                model.VisibilityId     = info.VisibilityId;
                model.Visibility       = info.Visibility;
                model.VideoId          = info.VideoId;
                model.Video            = info.Video;
                model.IsUploadFinished = info.IsUploadFinished;
                model.IsArchived       = info.IsArchived;

                model.Visibilities = _dataService.GetVisibilities();

                return(View(model));
            }

            _dataService.UpdateVideoInfo(videoInfo);

            return(RedirectToAction("Videos"));
        }
Ejemplo n.º 4
0
        public IActionResult EditVideoInfo(VideoInfo videoInfo)
        {
            if (!ModelState.IsValid)
            {
                VideoInfo info = _dataService.GetVideoInfo(videoInfo.Id);

                VideoInfoViewModel model = new VideoInfoViewModel()
                {
                    Id               = info.Id,
                    Description      = info.Description,
                    UploadDate       = info.UploadDate,
                    ThumbnailPath    = info.ThumbnailPath,
                    ProfileId        = info.ProfileId,
                    Profile          = info.Profile,
                    VisibilityId     = info.VisibilityId,
                    Visibility       = info.Visibility,
                    VideoId          = info.VideoId,
                    Video            = info.Video,
                    IsUploadFinished = info.IsUploadFinished,
                    IsArchived       = info.IsArchived,
                    Visibilities     = _dataService.GetVisibilities()
                };

                return(View(model));
            }

            // Finish upload
            videoInfo.IsUploadFinished = true;

            _dataService.UpdateVideoInfo(videoInfo);

            return(RedirectToAction("Profile", "Home", new { id = videoInfo.ProfileId }));
        }
Ejemplo n.º 5
0
 public VideoEditorWindow(VideoInfoViewModel video)
     : this()
 {
     this.EditVideoUserControl.ViewModel.Updated += this.VideoInfo_Updated;
     this.EditVideoUserControl.ViewModel.Parent   = video.SeriesView;
     this.EditVideoUserControl.ViewModel.ModifyMode(video);
 }
Ejemplo n.º 6
0
 public VideoEditorWindow(VideoInfoViewModel video)
     : this()
 {
     this.EditVideoUserControl.ViewModel.Updated += this.VideoInfo_Updated;
     this.EditVideoUserControl.ViewModel.Parent = video.SeriesView;
     this.EditVideoUserControl.ViewModel.ModifyMode(video);
 }
Ejemplo n.º 7
0
 private async void NavigateToVideoViewerPage(VideoInfoViewModel info)
 {
     var page = VideoViewerPage.BuildPage(info);
     page.GoBackButton.Click += this.VideoViewerPage_GoBackButton_Click;
     this.MainFrame.Navigate(page);
     await page.ViewModel.LoadAsync();
 }
Ejemplo n.º 8
0
 public void RefreshVideo(VideoInfoViewModel vm)
 {
     if (this.ViewModel.VideosViewModel.Items.Collection.Remove(vm))
     {
         vm.RefreshProperties();
         this.ViewModel.VideosViewModel.Items.Collection.Add(vm);
         this.ViewModel.ReloadGrouping();
     }
 }
Ejemplo n.º 9
0
        private async Task UntrackAsync(VideoInfoViewModel vm)
        {
            Debug.Assert(vm != null, "vm != null");

            if (await vm.UntrackAsync())
            {
                this.Refresh();
            }
        }
Ejemplo n.º 10
0
 public VideoViewerViewModel(VideoInfoViewModel info)
 {
     this.InfoView            = info;
     this.EntitesView         = new JasilyCollectionView <ObservableCollectionGroup <string, EntityViewModel> >();
     this.Background          = new BackgroundImageViewModel(this);
     this.VideoRoleCollection = new VideoRoleCollectionViewModel(info.SeriesView.Source, info.Source)
     {
         VideoViewerViewModel = this
     };
 }
Ejemplo n.º 11
0
 public VideoViewerViewModel(VideoInfoViewModel info)
 {
     this.InfoView = info;
     this.EntitesView = new JasilyCollectionView<ObservableCollectionGroup<string, EntityViewModel>>();
     this.Background = new BackgroundImageViewModel(this);
     this.VideoRoleCollection = new VideoRoleCollectionViewModel(info.SeriesView.Source, info.Source)
     {
         VideoViewerViewModel = this
     };
 }
Ejemplo n.º 12
0
        private async void NavigateToVideoViewerPage(VideoInfoViewModel info)
        {
            var page = new VideoViewerPage(info);

            page.ClickedGoBack     += this.VideoViewerPage_ClickedGoBack;
            page.ClickedOtherVideo += this.VideoViewerPage_ClickedOtherVideo;

            page.ViewModel.InfoView.SeriesView.PropertiesRefreshed += this.InfoView_PropertiesRefreshed;
            this.CaptionTextBlock.Text = Caption + " | " + info.SeriesView.NameViewModel.FirstLine;
            this.MainFrame.Navigate(page);
            await page.ViewModel.LoadAsync();
        }
Ejemplo n.º 13
0
        internal static VideoViewerPage BuildPage(VideoInfoViewModel info)
        {
            var vm = new VideoViewerViewModel(info);

            var page = new VideoViewerPage()
            {
                ViewModel = vm,
                DataContext = vm
            };

            Engines.ForEach(z => AppendToContextMenu(page.SeriesContextMenu, z));
            return page;
        }
            public bool Where(VideoInfoViewModel obj)
            {
                if (this.isOnlyTracking && !obj.Source.IsTracking)
                {
                    return(false);
                }
                if (this.filterText == null)
                {
                    return(true);
                }

                return(obj.SeriesView.Source.Id == this.filterText ||
                       obj.Source.Id == this.filterText ||
                       obj.Source.Names.Concat(obj.SeriesView.Source.Names)
                       .Any(z => z.Contains(this.filterText)));
            }
Ejemplo n.º 15
0
 private void ProcessTrackTask_CurrentWatchVideo(object sender, VideoInfoViewModel e)
 {
     this.Dispatcher.BeginInvoke(() =>
     {
         var win = this.TryFindParent<MainWindow>();
         if (win == null) return;
         if (ReferenceEquals(win.MainFrame.Content, this) &&
             win.MainFrameNavigationStatus.Status != NavigationServiceStatus.Navigating)
         {
             if (this.ViewModel.VideosViewModel.Items.Collection.Contains(e))
             {
                 this.VideoSelected?.Invoke(this, e);
             }
         }
     });
 }
Ejemplo n.º 16
0
 private void ProcessTrackTask_CurrentWatchVideo(object sender, VideoInfoViewModel e)
 {
     this.Dispatcher.BeginInvoke(() =>
     {
         var win = this.TryFindParent <MainWindow>();
         if (win == null)
         {
             return;
         }
         if (ReferenceEquals(win.MainFrame.Content, this) &&
             win.MainFrameNavigationStatus.Status != NavigationServiceStatus.Navigating)
         {
             if (this.ViewModel.VideosViewModel.Items.Collection.Contains(e))
             {
                 this.VideoSelected?.Invoke(this, e);
             }
         }
     });
 }
            public bool Where(VideoInfoViewModel obj)
            {
                if (this.OnlyTracking && !obj.Source.IsTracking)
                {
                    return(false);
                }
                if (this.Text == null)
                {
                    return(true);
                }

                return
                    (this.Text.Equals(obj.SeriesView.Source.Id, StringComparison.OrdinalIgnoreCase) ||
                     this.Text.Equals(obj.Source.Id, StringComparison.OrdinalIgnoreCase) ||
                     obj.Source.Names
                     .Concat(obj.SeriesView.Source.Names)
                     .Concat(obj.NameViewModel.QueryStrings)
                     .Concat(obj.SeriesView.NameViewModel.QueryStrings)
                     .Any(z => z.Contains(this.Text, StringComparison.OrdinalIgnoreCase)));
            }
Ejemplo n.º 18
0
        public IActionResult AddVideoInfo(int id)
        {
            VideoInfo info = _dataService.GetVideoInfo(id);

            // View Model used for the add screen
            VideoInfoViewModel model = new VideoInfoViewModel()
            {
                VideoId          = info.VideoId,
                ProfileId        = info.ProfileId,
                UploadDate       = info.UploadDate,
                VisibilityId     = info.VisibilityId,
                Visibilities     = _dataService.GetVisibilities(),
                Title            = info.Title,
                Description      = info.Description,
                ThumbnailPath    = info.ThumbnailPath,
                IsUploadFinished = info.IsUploadFinished
            };

            return(View(model));
        }
Ejemplo n.º 19
0
        public IActionResult EditVideoInfo(int id)
        {
            VideoInfo info = _dataService.GetVideoInfo(id);

            VideoInfoViewModel model = new VideoInfoViewModel()
            {
                Id               = info.Id,
                Description      = info.Description,
                UploadDate       = info.UploadDate,
                ThumbnailPath    = info.ThumbnailPath,
                ProfileId        = info.ProfileId,
                Profile          = info.Profile,
                VisibilityId     = info.VisibilityId,
                Visibility       = info.Visibility,
                VideoId          = info.VideoId,
                Video            = info.Video,
                IsUploadFinished = info.IsUploadFinished,
                IsArchived       = info.IsArchived,
                Visibilities     = _dataService.GetVisibilities()
            };

            return(View(model));
        }
Ejemplo n.º 20
0
        public IActionResult EditVideoInfo(int id)
        {
            VideoInfoViewModel model = new VideoInfoViewModel();

            VideoInfo info = _dataService.GetVideoInfo(id);

            model.Id               = info.Id;
            model.Title            = info.Title;
            model.Description      = info.Description;
            model.UploadDate       = info.UploadDate;
            model.ThumbnailPath    = info.ThumbnailPath;
            model.ProfileId        = info.ProfileId;
            model.Profile          = info.Profile;
            model.VisibilityId     = info.VisibilityId;
            model.Visibility       = info.Visibility;
            model.VideoId          = info.VideoId;
            model.Video            = info.Video;
            model.IsUploadFinished = info.IsUploadFinished;
            model.IsArchived       = info.IsArchived;

            model.Visibilities = _dataService.GetVisibilities();

            return(View(model));
        }
Ejemplo n.º 21
0
 public VideoViewerPage(VideoInfoViewModel info)
     : this()
 {
     this.DataContext = this.ViewModel = new VideoViewerViewModel(info);
     SearchEngineCenter.Engines.ForEach(z => AppendToContextMenu(this.SeriesContextMenu, z));
 }
Ejemplo n.º 22
0
 private void VideoViewerPage_ClickedOtherVideo(object sender, VideoInfoViewModel e)
 {
     this.nextVideo            = e;
     this.MainFrame.Navigated += this.MainFrame_NextVideo;
     this.ExitVideoViewerPage((VideoViewerPage)sender);
 }
Ejemplo n.º 23
0
 void MainPage_VideoSelected(object sender, VideoInfoViewModel e)
 {
     this.NavigateToVideoViewerPage(e);
 }
Ejemplo n.º 24
0
 void MainPage_VideoSelected(object sender, VideoInfoViewModel e) => this.NavigateToVideoViewerPage(e);
Ejemplo n.º 25
0
 public VideoViewerViewModel(VideoInfoViewModel info)
 {
     this.InfoView = info;
     this.EntitesView = new JasilyCollectionView<ObservableCollectionGroup<string, EntityViewModel>>();
 }
Ejemplo n.º 26
0
        private async Task UntrackAsync(VideoInfoViewModel vm)
        {
            Debug.Assert(vm != null, "vm != null");

            if (await vm.UntrackAsync())
            {
                this.Refresh();
            }
        }
Ejemplo n.º 27
0
 public VideoViewerPage(VideoInfoViewModel info)
     : this()
 {
     this.DataContext = this.ViewModel = new VideoViewerViewModel(info);
     SearchEngineCenter.Engines.ForEach(z => AppendToContextMenu(this.SeriesContextMenu, z));
 }
            public bool Where(VideoInfoViewModel obj)
            {
                if (this.isOnlyTracking && !obj.Source.IsTracking) return false;
                if (this.filterText == null) return true;

                return obj.SeriesView.Source.Id == this.filterText ||
                       obj.Source.Id == this.filterText ||
                       obj.Source.Names.Concat(obj.SeriesView.Source.Names)
                       .Any(z => z.Contains(this.filterText));
            }
 protected override bool ItemFilter(VideoInfoViewModel obj) => this.filter.Where(obj);
 protected override bool ItemFilter(VideoInfoViewModel obj) => this.filter.Where(obj);
Ejemplo n.º 31
0
        private async void NavigateToVideoViewerPage(VideoInfoViewModel info)
        {
            var page = new VideoViewerPage(info);
            page.ClickedGoBack += this.VideoViewerPage_ClickedGoBack;
            page.ClickedOtherVideo += this.VideoViewerPage_ClickedOtherVideo;

            page.ViewModel.InfoView.SeriesView.PropertiesRefreshed += this.InfoView_PropertiesRefreshed;
            this.CaptionTextBlock.Text = Caption + " | " + info.SeriesView.NameViewModel.FirstLine;
            this.MainFrame.Navigate(page);
            await page.ViewModel.LoadAsync();
        }
Ejemplo n.º 32
0
 private void VideoViewerPage_ClickedOtherVideo(object sender, VideoInfoViewModel e)
 {
     this.nextVideo = e;
     this.MainFrame.Navigated += this.MainFrame_NextVideo;
     this.ExitVideoViewerPage((VideoViewerPage)sender);
 }
 protected virtual bool ItemFilter(VideoInfoViewModel obj)
 {
     return true;
 }
Ejemplo n.º 34
0
 public void RefreshVideo(VideoInfoViewModel vm)
 {
     if (this.ViewModel.VideosViewModel.Items.Collection.Remove(vm))
     {
         vm.RefreshProperties();
         this.ViewModel.VideosViewModel.Items.Collection.Add(vm);
         this.ViewModel.ReloadGrouping();
     }
 }