VirtualUI provides a specialized application-side object called HTMLDoc, with methods that allow you to add web content without changing the original HTML or javascript files.
· Load and run Javascript files from the Windows app.
· Import HTML files from the Windows app.
· Securely access files not located in the web tree (needed to deploy web or media files along with your application).
· Create an HTML5 Web Component defined in an imported HTML file.
Thinfinity VirtualUI allows you to load and run Javascript files from the Windows app. In order to load a new javascript file, you can use the LoadScript method of the HTMLDoc component:
VirtualUI.HTMLDoc.LoadScript(URL, [Filename])
· The "URL" parameter is the Uniform Resource Locator pointing to the Javascript file location in the net.
· "Filename" is an optional parameter that, when specified, points to the actual Javascript file in the local file system. In this case the "URL" parameter will be virtual, and will resolve to this local "filename".
With the purpose of providing secure urls to files that are not located in the application's web tree, we included two methods:
VirtualUI.HTMLDoc.CreateSessionURL(URL, LocalPath)
This method allows you to create a virtual URL valid during the session's lifetime.
· The "URL" parameter is the virtual URL to access the Filename or Directory specified in LocalPath.
· "LocalPath" can be a file name or a directory. If it is a file name, the URL parameter resolves to that filename; if it is a directory, the URL parameter is a virtual path that can be used to access any file under this local directory.
URL = VirtualUI.HTMLDoc.GetUniqueURL(Filename, lifetime)
This method allows you to create a unique virtual URL for a specific file, valid during the time specified in minutes in the Lifetime parameter.
· The "Filename" parameter points to the local filename we want to create an unique URL for.
· "Lifetime" is the time during which the returned URL will be valid.
To create a Web Component instance, we added a specific method that will allow you to embed the component in the web page, tied or untied to a Windows control.
When the Web Component is tied to a Windows control, it will look like it is "embedded" in the form, replacing the Windows control area, following its position and size when it changes. When untied, it will be embedded into the web page, but its position and size will not be attached to any control area.
VirtualUI.HTMLDoc.CreateComponent(Id, TagOrHTML, ReplaceWnd)
· "Id" parameter is the HTML element ID.
· "TagOrHTML" can be a tagname or a valid HTML string.
· "ReplaceWnd" is the handle to the window control to be "replaced".
Examples:
Adding a tied Web Component by the tagname:
VirtualUI.HTMLDoc.CreateComponent("video1", "vui-video", panel1.Handle)
In this example, the HTML "<vui-video></vui-video>" will be inserted, and dynamically positioned according to panel1's position and size.
Adding tied HTML content from a valid HTML string:
VirtualUI.HTMLDoc.CreateComponent("hworld", "<div><span>hello world</span></div>", panel1.Handle)
In this example, the HTML "<div><span>hello world</span></div>" will be inserted, and dynamically positioned according to panel1's position and size.
Adding an untied Web Component by the tagname:
VirtualUI.HTMLDoc.CreateComponent("qzprinter1", "qzprinter")
In this example, the Web Component will be inserted, but not positioned according to any visible control.
Thinfinity VirtualUI allows you to insert HTML content into the current web page. You can do this from your Windows app by calling the ImportHTML method of the HTMLDoc component:
VirtualUI.HTMLDoc.ImportHTML(URL, [Filename])
· The "URL" parameter is the Uniform Resource Locator pointing to the HTML file location in the net.
· "Filename" is an optional parameter that, when specified, points to the actual HTML file in the local file system. In this case, the "URL" parameter will be virtual, and will translate to this local "filename".