// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // Audio Behaviours // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrakeWPF.Model.Audio { using System.ComponentModel; using System.Linq; using HandBrakeWPF.Utilities; /// /// Audio Behaviours /// public class AudioBehaviours : PropertyChangedBase { private AudioBehaviourModes selectedBehaviour; private BindingList selectedLangauges; private AudioTrackDefaultsMode trackDefaultBehaviour; /// /// Initializes a new instance of the class. /// public AudioBehaviours() { this.SelectedBehaviour = AudioBehaviourModes.None; this.SelectedTrackDefaultBehaviour = AudioTrackDefaultsMode.None; this.SelectedLangauges = new BindingList(); } /// /// Initializes a new instance of the class. /// /// /// The behaviours. /// public AudioBehaviours(AudioBehaviours behaviours) { this.SelectedBehaviour = behaviours.SelectedBehaviour; this.SelectedTrackDefaultBehaviour = behaviours.SelectedTrackDefaultBehaviour; this.SelectedLangauges = new BindingList(behaviours.selectedLangauges.ToList()); } /// /// Gets or sets the selected behaviour. /// public AudioBehaviourModes SelectedBehaviour { get { return this.selectedBehaviour; } set { if (value == this.selectedBehaviour) { return; } this.selectedBehaviour = value; this.NotifyOfPropertyChange(() => this.SelectedBehaviour); } } /// /// Gets or sets the track default behaviour. /// public AudioTrackDefaultsMode SelectedTrackDefaultBehaviour { get { return this.trackDefaultBehaviour; } set { if (value == this.trackDefaultBehaviour) { return; } this.trackDefaultBehaviour = value; this.NotifyOfPropertyChange(() => this.SelectedTrackDefaultBehaviour); } } /// /// Gets or sets the selected langauges. /// public BindingList SelectedLangauges { get { return this.selectedLangauges; } set { if (Equals(value, this.selectedLangauges)) { return; } this.selectedLangauges = value; this.NotifyOfPropertyChange(() => this.SelectedLangauges); } } /// /// Clone this object /// /// /// The . /// public AudioBehaviours Clone() { AudioBehaviours cloned = new AudioBehaviours { SelectedBehaviour = this.selectedBehaviour, SelectedLangauges = new BindingList(), SelectedTrackDefaultBehaviour = this.SelectedTrackDefaultBehaviour }; foreach (var item in this.SelectedLangauges) { cloned.SelectedLangauges.Add(item); } return cloned; } } }