bool IContextMenuHandler.OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags) { if ((int)commandId == OpenLinkInNewTab) { //browser.ShowDevTools(); OpenInNewTabContextMenu?.Invoke(this, new NewTabEventArgs(parameters.UnfilteredLinkUrl)); } if ((int)commandId == CloseDevTools) { browser.CloseDevTools(); } if ((int)commandId == MenuSaveImage) { DownloadImage?.Invoke(this, new DownloadImageViaContextMenuEventArgs(parameters.SourceUrl)); } if ((int)commandId == ViewSource) { ViewPageSource?.Invoke(this, null); } if ((int)commandId == SaveYouTubeVideo) { DownloadYouTubeVideo?.Invoke(this, null); //we have the address, anyway, so don't need to pass it via event args. } if ((int)commandId == ViewImageExifData) { ViewImageExif?.Invoke(this, new ExifViewerEventArgs(parameters.SourceUrl)); } if ((int)commandId == ViewFacebookId) { ViewFacebookIdNum?.Invoke(this, EventArgs.Empty); } if ((int)commandId == ViewTwitterId) { ViewTwitterIdNum?.Invoke(this, EventArgs.Empty); } if ((int)commandId == CopyImgLocation) { CopyImageLocation?.Invoke(this, new ExifViewerEventArgs(parameters.SourceUrl)); } if ((int)commandId == ReverseImageSearch) { ReverseImgSearch?.Invoke(this, new ExifViewerEventArgs(parameters.SourceUrl)); } if ((int)commandId == ExtractAllLinks) { ExtractLinks?.Invoke(this, EventArgs.Empty); } if ((int)commandId == Bookmark) { AddPageToBookmarks?.Invoke(this, EventArgs.Empty); } return(false); }
bool IContextMenuHandler.OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags) { if ((int)commandId == OpenLinkInNewTab) { //browser.ShowDevTools(); OpenInNewTabContextMenu?.Invoke(this, new NewTabEventArgs(parameters.UnfilteredLinkUrl)); } if ((int)commandId == CloseDevTools) { browser.CloseDevTools(); } if ((int)commandId == MenuSaveImage) { DownloadImage?.Invoke(this, new DownloadImageViaContextMenuEventArgs(parameters.SourceUrl)); } if ((int)commandId == ViewSource) { ViewPageSource?.Invoke(this, null); } if ((int)commandId == SaveYouTubeVideo) { DownloadYouTubeVideo?.Invoke(this, null); //we have the address, anyway, so don't need to pass it via event args. } if ((int)commandId == ViewImageExifData) { ViewImageExif?.Invoke(this, new TextEventArgs(parameters.SourceUrl)); } if ((int)commandId == ViewFacebookId) { ViewFacebookIdNum?.Invoke(this, EventArgs.Empty); } if ((int)commandId == ViewTwitterId) { ViewTwitterIdNum?.Invoke(this, EventArgs.Empty); } if ((int)commandId == CopyImgLocation) { CopyImageLocation?.Invoke(this, new TextEventArgs(parameters.SourceUrl)); } if ((int)commandId == ReverseImageSearchTineye) { ReverseImgSearch?.Invoke(this, new TextEventArgs("http://www.tineye.com/search/?url=" + parameters.SourceUrl)); } if ((int)commandId == ReverseImageSearchGoogle) { ReverseImgSearch?.Invoke(this, new TextEventArgs("https://www.google.com/searchbyimage?&image_url=" + Uri.EscapeUriString(parameters.SourceUrl))); } if ((int)commandId == ReverseImageSearchYandex) { ReverseImgSearch?.Invoke(this, new TextEventArgs("https://yandex.com/images/search?url=" + Uri.EscapeUriString(parameters.SourceUrl) + "&rpt=imageview")); } if ((int)commandId == ExtractAllLinks) { ExtractLinks?.Invoke(this, EventArgs.Empty); } if ((int)commandId == Bookmark) { AddPageToBookmarks?.Invoke(this, EventArgs.Empty); } if ((int)commandId == SearchSelectedText) { SearchText?.Invoke(this, new TextEventArgs(parameters.SelectionText)); } if ((int)commandId == SaveText) { SaveSelectedText?.Invoke(this, new TextEventArgs(parameters.SelectionText)); } return(false); }