fix every last warning in every last file (non-html at least)
This commit is contained in:
parent
dc5d26d13e
commit
f7eef416d9
14 changed files with 154 additions and 189 deletions
|
@ -2,81 +2,86 @@
|
|||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
|
||||
public class MenuHandler : IContextMenuHandler
|
||||
namespace XeroBrowser
|
||||
{
|
||||
public void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
|
||||
public class MenuHandler : IContextMenuHandler
|
||||
{
|
||||
// Remove any existent option using the Clear method of the model
|
||||
//
|
||||
//model.Clear();
|
||||
|
||||
Console.WriteLine("Context menu opened !");
|
||||
|
||||
// You can add a separator in case that there are more items on the list
|
||||
if (model.Count > 0)
|
||||
public void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
|
||||
{
|
||||
model.AddSeparator();
|
||||
}
|
||||
// Remove any existent option using the Clear method of the model
|
||||
//
|
||||
//model.Clear();
|
||||
|
||||
Console.WriteLine(@"Context menu opened !");
|
||||
|
||||
// Add a new item to the list using the AddItem method of the model
|
||||
//model.AddItem((CefMenuCommand)113, "Copy link address");
|
||||
model.AddItem((CefMenuCommand)114, "Paste");
|
||||
|
||||
// Add a separator
|
||||
//model.AddSeparator();
|
||||
|
||||
}
|
||||
|
||||
public bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags)
|
||||
{
|
||||
// React to the first ID (show dev tools method)
|
||||
if (commandId == (CefMenuCommand)26501)
|
||||
{
|
||||
browser.GetHost().ShowDevTools();
|
||||
return true;
|
||||
}
|
||||
|
||||
// React to the second ID (show dev tools method)
|
||||
if (commandId == (CefMenuCommand)26502)
|
||||
{
|
||||
browser.GetHost().CloseDevTools();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Any new item should be handled through a new if statement
|
||||
if ((int)commandId == 113)
|
||||
{
|
||||
//using System.Windows.Forms;
|
||||
try
|
||||
// You can add a separator in case that there are more items on the list
|
||||
if (model.Count > 0)
|
||||
{
|
||||
Clipboard.SetText(parameters.SourceUrl);
|
||||
model.AddSeparator();
|
||||
}
|
||||
catch (ArgumentException) { };
|
||||
|
||||
|
||||
// Add a new item to the list using the AddItem method of the model
|
||||
//model.AddItem((CefMenuCommand)113, "Copy link address");
|
||||
model.AddItem((CefMenuCommand)114, "Paste");
|
||||
|
||||
// Add a separator
|
||||
//model.AddSeparator();
|
||||
|
||||
}
|
||||
return false;
|
||||
|
||||
public bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags)
|
||||
{
|
||||
// React to the first ID (show dev tools method)
|
||||
if (commandId == (CefMenuCommand)26501)
|
||||
{
|
||||
browser.GetHost().ShowDevTools();
|
||||
return true;
|
||||
}
|
||||
|
||||
// React to the second ID (show dev tools method)
|
||||
if (commandId == (CefMenuCommand)26502)
|
||||
{
|
||||
browser.GetHost().CloseDevTools();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Any new item should be handled through a new if statement
|
||||
if ((int)commandId == 113)
|
||||
{
|
||||
//using System.Windows.Forms;
|
||||
try
|
||||
{
|
||||
Clipboard.SetText(parameters.SourceUrl);
|
||||
}
|
||||
catch (ArgumentException) { }
|
||||
}
|
||||
return false;
|
||||
|
||||
|
||||
#pragma warning disable CS0162 // Unreachable code detected
|
||||
if ((int)commandId == 114)
|
||||
{
|
||||
//using System.Windows.Forms;
|
||||
Clipboard.GetText();
|
||||
}
|
||||
/*
|
||||
if ((int)commandId == 114)
|
||||
{
|
||||
//using System.Windows.Forms;
|
||||
Clipboard.GetText();
|
||||
}
|
||||
#pragma warning restore CS0162 // Unreachable code detected
|
||||
return false;
|
||||
return false;
|
||||
*/
|
||||
|
||||
// Return false should ignore the selected option of the user !
|
||||
}
|
||||
// Return false should ignore the selected option of the user !
|
||||
}
|
||||
|
||||
public void OnContextMenuDismissed(IWebBrowser browserControl, IBrowser browser, IFrame frame)
|
||||
{
|
||||
public void OnContextMenuDismissed(IWebBrowser browserControl, IBrowser browser, IFrame frame)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public bool RunContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model, IRunContextMenuCallback callback)
|
||||
{
|
||||
return false;
|
||||
public bool RunContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model, IRunContextMenuCallback callback)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue