public QueueTitlesDialogViewModel(List<Title> allTitles) { this.main = Ioc.Container.GetInstance<MainViewModel>(); this.selectedTitles = new ObservableCollection<TitleSelectionViewModel>(); this.selectRange = Config.QueueTitlesUseRange; this.startRange = Config.QueueTitlesStartTime; this.endRange = Config.QueueTitlesEndTime; this.titleStartOverrideEnabled = Config.QueueTitlesUseTitleOverride; this.titleStartOverride = Config.QueueTitlesTitleOverride; this.directoryOverrideEnabled = Config.QueueTitlesUseDirectoryOverride; this.directoryOverride = Config.QueueTitlesDirectoryOverride; this.nameOverrideEnabled = Config.QueueTitlesUseNameOverride; this.nameOverride = Config.QueueTitlesNameOverride; this.titles = new List<TitleSelectionViewModel>(); foreach (Title title in allTitles) { var titleVM = new TitleSelectionViewModel(title, this); this.titles.Add(titleVM); } // Perform range selection if enabled. if (this.selectRange) { this.SetSelectedFromRange(); } this.selectedTitles.CollectionChanged += (sender, args) => { this.RaisePropertyChanged(() => this.TitleDetailsVisible); if (this.selectedTitles.Count == 1) { Title title = this.selectedTitles[0].Title; // Do preview var previewProfile = new VCProfile { CustomCropping = true, Cropping = new Cropping(), VideoEncoder = "x264", AudioEncodings = new List<AudioEncoding>() }; var previewJob = new VCJob { RangeType = VideoRangeType.All, Title = title.TitleNumber, EncodingProfile = previewProfile }; this.PreviewImage = this.main.ScanInstance.GetPreview(previewJob.HbJob, 2); this.RaisePropertyChanged(() => this.TitleText); } }; }
private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { this.viewModel = this.DataContext as MainViewModel; this.viewModel.PropertyChanged += this.ViewModelPropertyChanged; this.viewModel.AnimationStarted += this.ViewModelAnimationStarted; this.processingVM.PropertyChanged += (sender2, e2) => { if (e2.PropertyName == "CompletedItemsCount") { this.RefreshQueueTabs(); } }; this.RefreshQueueTabs(); }