namespace VideoBrowser.Controls.CefSharpBrowser
{
using System.ComponentModel;
using System.Windows.Input;
using System.Windows.Media;
using VideoBrowser.Common;
using VideoBrowser.Controls.CefSharpBrowser.ViewModels;
using VideoBrowser.Extensions;
///
/// Defines the .
///
public abstract class AddInButton : NotifyPropertyChanged
{
#region Fields
private Geometry _icon;
private bool _isEnabled = true;
private string _toolTip;
private bool isVisible;
#endregion Fields
#region Constructors
///
/// Initializes a new instance of the class.
///
/// The name.
protected AddInButton(string name = null)
{
if (name == null)
{
name = this.GetType().Name;
}
this.Name = name;
this.Command = new RelayCommand(this.OnExecute, $"{this.Name} add in is executed");
}
#endregion Constructors
#region Properties
///
/// Gets the Command.
///
public ICommand Command { get; }
///
/// Gets or sets the Icon.
///
public Geometry Icon { get => _icon; set => this.Set(this.PropertyChangedHandler, ref _icon, value); }
///
/// Gets or sets a value indicating whether IsEnabled.
///
public bool IsEnabled { get => _isEnabled; set => this.Set(this.PropertyChangedHandler, ref _isEnabled, value); }
///
/// Gets or sets a value indicating whether IsVisible.
///
public bool IsVisible { get => isVisible; set => this.Set(this.PropertyChangedHandler, ref isVisible, value); }
///
/// Gets or sets the Name.
///
public string Name { get; set; }
///
/// Gets or sets the ToolTip.
///
public string ToolTip { get => _toolTip; set => this.Set(this.PropertyChangedHandler, ref _toolTip, value); }
#endregion Properties
#region Methods
///
/// The Execute.
///
/// The viewModel.
protected abstract void Execute(WebBrowserTabControlViewModel viewModel);
///
/// The OnExecute.
///
/// The obj.
private void OnExecute(object obj)
{
var viewModel = obj as WebBrowserTabControlViewModel;
this.Execute(viewModel);
}
#endregion Methods
}
}