Freelance Project Requests info@CodeDocu.de Software Development in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net
#

Awesomium: Code example in Windows Forms
 
Awesomium is a webbrowser control for .net applications based on the chrome browser.
You need the chrome browser control, if the default webBrowser control from Microsoft, since this is based on the old Internet Explorer.
The control is available after installing Visual Studio as a design control and can be embedded in Windows Forms and WPF applications.
 
The Awesomium is drawn like the Microsoft Web browser control in the application and then acts like a genetic constant Web browser.
While it acts on AJAX JSON changes at run time as a real browser.
Here the Awesomium chrome browser control applied to Google translate.

 
Awesomium in design mode, see Windows Forms:

 
Open a Web page:
To navigate to a Web page, it simply sets the WebControl.Source
 

webControl1.Source = new Uri( "http://translate.google.com");
 

 
 
Type values:
If you want to set a value in an HTML element at run time, to do that via the method:
 
webControl.ExecuteJavascript (= htmlElement.value'new value ' ))
 

webControl1.ExecuteJavascript("document.getElementById('source').value='Mein Name ist Raimund'");
 

 
 
He readresults:
Evaluating individual HTML are elements on the Web page as shown here by the method:
 
Result = webControl.ExecuteJavascriptWithResult (htmlElement.textContent ))
 

string sResult=webControl1.ExecuteJavascriptWithResult("document.getElementById('result_box').textContent");
MessageBox.Show(sResult);
 

 
 
 
C# code as an example of the upper Windows Forms application

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace wfBrowser_Awesomium
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
 
private void btnOpen_Click(object sender, EventArgs e)
{
webControl1.Source = new Uri( "http://translate.google.com");
}
 
private void btnSetTranslate_Click(object sender, EventArgs e)
{
webControl1.ExecuteJavascript("document.getElementById('source').value='Mein Name ist Raimund'");
}
 
private void btnResult_Click(object sender, EventArgs e)
{
string sResult=webControl1.ExecuteJavascriptWithResult("document.getElementById('result_box').textContent");
MessageBox.Show(sResult);
}
}
}
 
 
//html Elements:
//http://www.w3schools.com/jsref/dom_obj_all.asp

 
Mobile

.

Contact for Jobs, Project Requests: raimund.popp@microsoft-programmierer.de