Проекты

Browser Plugin

Plugin added feature to launch and automate Trident (MSIE) from inside of the host application.

Menu item is available at View→Browser.

So far, the plugin has limited functionality that allows you to only show the Trident window, but in the future, the plugin will add the ability to download elements of any site using templates and UI to form for these very templates.

After version 1.0.6029.38952 added feature to map templates from XPath to HTML DOM structure and feature to search by DOM resulting System.Windows.Forms.HtmlElement.

External members

How to open window

Basic window with Trident control
if(this.Plugin.HostWindows.Windows.CreateWindow("7476853a-3a40-4d5f-a5b5-a00f1dc4d24c", "Plugin.Browser.DocumentBrowser", true, "https://dkorablin.ru") == null)
	System.Diagnostics.Process.Start("https://dkorablin.ru");

How to open window to edit XPath

User interface inside MDI host
/*As a example I'm sending previously filled nodes*/
Dictionary<String, String> nodes = new Dictionary<String, String>()
{
	{ "Date", "/div[2]/div[2]/div[0]/div[0]/div[2]/span[className=current]/a" },
	{ "Next", "/div[2]/div[2]/div[0]/div[0]/div[0]/a[className=arr]" },
	{ "Image", "/div[2]/div[2]/div[0]/div[1]/img" },
	{ "Author", "/div[2]/div[2]/div[1]/span[className=backlink]" },
};
IWindow result = this.HostWindows.Windows.CreateWindow("7476853a-3a40-4d5f-a5b5-a00f1dc4d24c",
	"Plugin.Browser.DocumentBrowserWizard",
	false,
	new KeyValuePair<String, Object>("CallerPluginId", /*String ID of the plugin who is opening window*/),
	new KeyValuePair<String, Object>("NavigateUrl", /*String Hyperlink where nodes must be selected (user can change link in the UI)*/),
	new KeyValuePair<String, Object>("Nodes", nodes));

if(result != null)
{
	result.AddEventHandler("SaveNodesEvent", new EventHandler<DataEventArgs>(browserWizard_SaveNodes);
}

How to find nodes while passing XPath and HtmlElement

System.Windows.Forms.HtmlElement body = this.Document.Body;
String xpath = "/div[2]/div[2]/div[1]/span[className=backlink]";

IPluginDescription plugin = this.Window.Plugin.Host.Plugins["7476853a-3a40-4d5f-a5b5-a00f1dc4d24c"];
if(plugin != null)
{
	IPluginMethodInfo member = plugin.GetMember<IPluginMethodInfo>("FindNodes");
	if(member == null)
		throw new ArgumentNullException("Method 'FindNodes' not found in plugin '7476853a-3a40-4d5f-a5b5-a00f1dc4d24c'");
	IEnumerable<System.Windows.Forms.HtmlElement> foundNodes = (IEnumerable<System.Windows.Forms.HtmlElement>)member.Invoke(body, xpath);
}
Теги:

Скачать

Ссылки

Родительские файлы