private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { this.viewModel = e.NewValue as EncodingWindowViewModel; if (this.viewModel != null) { this.SetPanelOpenState(this.viewModel.PresetPanelOpen); this.viewModel.PropertyChanged += this.OnPropertyChanged; } }
public ContainerPanelViewModel(EncodingWindowViewModel encodingWindowViewModel) : base(encodingWindowViewModel) { this.AutomaticChange = true; this.RegisterProfileProperties(); this.containerChoices = new List <ComboChoice>(); foreach (HBContainer hbContainer in HandBrakeEncoderHelpers.Containers) { this.containerChoices.Add(new ComboChoice(hbContainer.ShortName, hbContainer.DefaultExtension.ToUpperInvariant())); } this.WhenAnyValue( x => x.ContainerName, containerName => { HBContainer container = HandBrakeEncoderHelpers.GetContainer(containerName); return(container.DefaultExtension == "mp4"); }) .ToProperty(this, x => x.ShowMp4Choices, out this.showMp4Choices); this.AutomaticChange = false; }