namespace VideoBrowser.Controls.CefSharpBrowser
{
using Dragablz;
using System;
using System.Windows.Media;
using VideoBrowser.Controls.CefSharpBrowser.ViewModels;
using VideoBrowser.Controls.CefSharpBrowser.Views;
using VideoBrowser.Helpers;
///
/// Defines the .
///
public class TabItem : HeaderedItemViewModel, IDisposable
{
#region Fields
private Geometry _icon;
#endregion Fields
#region Constructors
///
/// Initializes a new instance of the class.
///
public TabItem() : this(Guid.Empty)
{
}
///
/// Initializes a new instance of the class.
///
/// The unique identifier.
public TabItem(Guid guid)
{
this.Guid = guid;
this.HeaderViewModel = new WebBrowserTabHeaderViewModel { Header = "No Header" };
UIThreadHelper.Invoke(() =>
{
this.Header = new WebBrowserTabHeaderView { DataContext = this.HeaderViewModel };
});
}
#endregion Constructors
#region Properties
///
/// Gets a value indicating whether Disposed.
///
public bool Disposed { get; private set; }
///
/// Gets the Guid.
///
public Guid Guid { get; }
///
/// Gets the HeaderViewModel.
///
public WebBrowserTabHeaderViewModel HeaderViewModel { get; }
///
/// Gets or sets the Icon.
///
public Geometry Icon
{
get => _icon;
set
{
if (_icon == value)
{
return;
}
_icon = value;
this.OnPropertyChanged();
}
}
///
/// Gets or sets the Title.
///
public string Title
{
get => this.HeaderViewModel.Header;
set
{
if (this.Title == value)
{
return;
}
this.HeaderViewModel.Header = value;
this.OnPropertyChanged();
}
}
#endregion Properties
#region Methods
///
/// The Dispose.
///
public void Dispose()
{
if (this.Disposed)
{
return;
}
this.Disposed = true;
this.Dispose(true);
}
///
/// The Dispose.
///
/// The disposing.
protected virtual void Dispose(bool disposing)
{
this.Content = null;
this.Header = null;
}
#endregion Methods
}
}