// --------------------------------------------------------------------------------------------------------------------
//
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
//
//
// Defines the PopupWindowViewModel type.
//
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.ViewModels
{
using HandBrakeWPF.ViewModels.Interfaces;
///
/// The popup window view model.
///
public class PopupWindowViewModel : ViewModelBase, IPopupWindowViewModel
{
private string windowTitle;
private string subText;
///
/// Initializes a new instance of the class.
///
///
/// The content View Model.
///
///
/// The title.
///
///
/// The sub Text.
///
public PopupWindowViewModel(IViewModelBase contentViewModel, string title, string subText)
{
this.ContentViewModel = contentViewModel;
this.WindowTitle = title;
this.Title = title;
this.SubText = subText;
}
///
/// Gets or sets the content view model.
///
public IViewModelBase ContentViewModel { get; set; }
///
/// Gets or sets the title.
///
public string WindowTitle
{
get
{
return this.windowTitle;
}
set
{
if (value == this.windowTitle)
{
return;
}
this.windowTitle = value;
this.NotifyOfPropertyChange(() => this.Title);
}
}
///
/// Gets or sets the sub text.
///
public string SubText
{
get
{
return this.subText;
}
set
{
if (value == this.subText)
{
return;
}
this.subText = value;
this.SubTextVisible = !string.IsNullOrEmpty(value);
this.NotifyOfPropertyChange(() => this.SubText);
this.NotifyOfPropertyChange(() => this.SubTextVisible);
}
}
///
/// Gets or sets a value indicating whether sub text visible.
///
public bool SubTextVisible { get; set; }
///
/// The save.
///
public void Save()
{
this.TryClose(true);
}
///
/// The cancel.
///
public void Cancel()
{
this.TryClose(false);
}
}
}