Download MovieTube.Viewer/Controls/WebViewWidget.cs from niobures/VideoSearch: direct link, hf CLI and curl.
- Browser
- Download file 3.69 kB
-
https://huggingface.co/niobures/VideoSearch/resolve/main/MovieTube.Viewer/Controls/WebViewWidget.cs
- Command line
-
hf download hf://niobures/VideoSearch/MovieTube.Viewer/Controls/WebViewWidget.cs
-
curl -L -o WebViewWidget.cs https://huggingface.co/niobures/VideoSearch/resolve/main/MovieTube.Viewer/Controls/WebViewWidget.cs
3.69 kB
| using System; | |
| using System.Collections.Generic; | |
| using System.ComponentModel; | |
| using System.Drawing; | |
| using System.Data; | |
| using System.Text; | |
| using System.Windows.Forms; | |
| using HtmlRenderer.Entities; | |
| using MovieTube.Viewer.Data; | |
| using MovieTube.Client.Scraper; | |
| namespace MovieTube.Viewer | |
| { | |
| public partial class WebViewWidget : UserControl, IWidget | |
| { | |
| public event EventHandler<GalleryItemSelectedEventArgs> ViewSelected; | |
| public event EventHandler<GalleryItemFavouriteEventArgs> Favourited; | |
| private Movie data; | |
| private ClientDataService dataService = ClientDataService.Single; | |
| public WebViewWidget() | |
| { | |
| InitializeComponent(); | |
| } | |
| public WebViewWidget(Movie data, string html) | |
| :this() | |
| { | |
| this.SuspendLayout(); | |
| this.pictureBox.Visible = ClientDataService.Single.IsFavourite(data); | |
| this.data = data; | |
| this.htmlPanel.Text = html; | |
| this.htmlPanel.AutoScroll = false; | |
| this.AutoScroll = false; | |
| this.htmlPanel.VerticalScroll.Enabled = false; | |
| this.htmlPanel.HorizontalScroll.Enabled = false; | |
| this.htmlPanel.VerticalScroll.Visible = false; | |
| this.htmlPanel.HorizontalScroll.Visible = false; | |
| this.pictureBoxNewMovie.Visible = Constants.IsNewMovie(data); | |
| this.pictureBoxNewLink.Visible = Constants.IsNewLink(data); | |
| this.ResumeLayout(); | |
| } | |
| private void htmlPanel_LinkClicked(object sender, HtmlLinkClickedEventArgs e) | |
| { | |
| e.Handled = true; | |
| } | |
| private void htmlPanel_Click(object sender, EventArgs e) | |
| { | |
| if (ViewSelected != null) | |
| ViewSelected(this, new GalleryItemSelectedEventArgs( data)); | |
| } | |
| private void contextMenuStrip_Opening(object sender, CancelEventArgs e) | |
| { | |
| UpdateFavourite(); | |
| } | |
| private void addToFavouriteToolStripMenuItem_Click(object sender, EventArgs e) | |
| { | |
| dataService.AddToFavourite(this.data); | |
| UpdateFavourite(); | |
| if (Favourited != null) | |
| Favourited(this, new GalleryItemFavouriteEventArgs(this.data, true)); | |
| } | |
| private void deleteFromFavouriteToolStripMenuItem_Click(object sender, EventArgs e) | |
| { | |
| dataService.DeleteFromFavourite(this.data); | |
| UpdateFavourite(); | |
| if (Favourited != null) | |
| Favourited(this, new GalleryItemFavouriteEventArgs(this.data, false)); | |
| } | |
| private void UpdateFavourite() | |
| { | |
| var fav = this.dataService.IsFavourite(this.data); | |
| this.addToFavouriteToolStripMenuItem.Visible = !fav; | |
| this.deleteFromFavouriteToolStripMenuItem.Visible = fav; | |
| this.pictureBox.Visible = fav; | |
| } | |
| public void RefreshView() | |
| { | |
| UpdateFavourite(); | |
| } | |
| public void SelectView() | |
| { | |
| this.htmlPanel.BackColor = SystemColors.ActiveCaption; | |
| } | |
| public void DeselectView() | |
| { | |
| this.htmlPanel.BackColor = SystemColors.Window; | |
| } | |
| public Movie Video | |
| { | |
| get | |
| { | |
| return this.data; | |
| } | |
| } | |
| } | |
| interface IWidget | |
| { | |
| void SelectView(); | |
| void DeselectView(); | |
| } | |
| } | |