namespace VideoBrowser.Controls.CefSharpBrowser.AddIns
{
using System.Collections.Generic;
using VideoBrowser.Controls.CefSharpBrowser.Models;
using VideoBrowser.Controls.CefSharpBrowser.Resources;
using VideoBrowser.Controls.CefSharpBrowser.ViewModels;
using VideoBrowser.Extensions;
///
/// Defines the .
///
public class BookmarkAddIn : AddInButton
{
#region Fields
private string url;
#endregion Fields
#region Constructors
///
/// Initializes a new instance of the class.
///
internal BookmarkAddIn()
{
this.Icon = BrowserIcons.StarWF;
this.ToolTip = "Bookmark this page";
}
#endregion Constructors
#region Properties
///
/// Gets or sets the BookmarkModels.
///
public IList BookmarkModels { get; set; }
///
/// Gets or sets the Url.
///
public string Url
{
get => url;
set
{
if (!this.Set(this.PropertyChangedHandler, ref url, value))
{
return;
}
this.IsVisible = !string.IsNullOrEmpty(this.Url);
var bookmarkExist = false;
if (this.BookmarkModels != null)
{
foreach (var bookmark in this.BookmarkModels)
{
if (bookmark.Url == this.Url)
{
bookmarkExist = true;
break;
}
}
}
this.Icon = bookmarkExist ? BrowserIcons.Star : BrowserIcons.StarWF;
}
}
#endregion Properties
#region Methods
///
/// The Execute.
///
/// The viewModel.
protected override void Execute(WebBrowserTabControlViewModel viewModel)
{
}
#endregion Methods
}
}