Author Topic: AdvancedHMI in the Browser  (Read 3699 times)

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
AdvancedHMI in the Browser
« on: April 08, 2018, 06:08:40 PM »
It is kind of possible to get AHMI run in the Internet browser, a combination of WPF and VB Net (or C#) as per these instructions:

https://www.codeproject.com/Articles/31429/Embedding-a-NET-WinForms-Application-in-an-Interne


The final AHMI screen is interactive but the drivers seem to be blocked by the browser.


For this to work, as in the attached picture, I also had to:

- remove AdvancedHMIcs project from the solution
- choose WPF browser app for VB instead of for C#
- convert the author's Page1 code from C# to VB Net and then comment out the namespace
- set all other projects to target Net Framework 4.5
- reference all these AHMI projects in the WPFHost project and also include AHMI dll references
- change the AdvancedHMI project's compile option for Target CPU from x86 to AnyCPU
- set the AdvancedHMI project's security to full trust
- un-check the WPFHost project's publish option to use ".deploy" file extensions

Currently, it seems to work fine with the Internet Explorer browser while Google Chrome only offered to save the file (the author of the article used Mozilla Firefox browser).

Just an attempt to bring AHMI closer to possibly being run remotely via web.

Here is Page1.xaml.vb code (converted and modified from the original):

Code: [Select]
Imports System.Windows.Controls
Imports System.Windows.Forms.Integration
Imports MfgControl.AdvancedHMI

''' <summary>
''' Interaction logic for Page1.xaml
''' </summary>
Public Class Page1
    Inherits Page

    Private mainForm As MainForm = New MainForm

    Public Sub New()
        MyBase.New()
        InitializeComponent()
        windowsFormsHost.Width = Me.mainForm.Width
        windowsFormsHost.Height = Me.mainForm.Height
        Me.mainForm.TopLevel = False
        windowsFormsHost.Child = Me.mainForm
    End Sub

End Class
« Last Edit: May 23, 2019, 11:20:21 PM by Godra »

Phrog30

  • Guest
Re: AdvancedHMI in the Browser
« Reply #1 on: April 08, 2018, 06:48:55 PM »
I'm confused, without the drivers what would be the point?

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: AdvancedHMI in the Browser
« Reply #2 on: April 08, 2018, 07:37:03 PM »
This is, currently, as far as I managed to go with this.

Maybe there is a way to make the drivers work or just use this example for some other purposes.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: AdvancedHMI in the Browser
« Reply #3 on: April 09, 2018, 03:26:10 PM »
Theoretically speaking, drivers should only work at the location where PLC is and only UI screen should be served over the web.

This WinForms via WPF approach seems to be designed more for self-contained apps that don’t really require external communication (unless it's through some sort of JavaScript or similar).

So, just use this example for other purposes.

AHMI over the web seems to need to be achieved by using remote desktop apps, like VNC or Microsoft RDP or Chrome Remote Desktop or ...

Mikefly95

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: AdvancedHMI in the Browser
« Reply #4 on: May 16, 2018, 09:22:26 AM »
I turned AHMI into a WCF server application and I can connect to it from any platform. With that you could create a asp.net webform page to connect to the WCF app and send/receive data via HTTP or TCIP. Also super easy to include a database in the system for logging and reporting. Not sure if this is a path you would be interested in  but I have had the system in place for a couple of years in a production environment.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: AdvancedHMI in the Browser
« Reply #5 on: May 16, 2018, 09:28:41 AM »
If you do post as many details as possible then somebody might have a good use for it.

Mikefly95

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: AdvancedHMI in the Browser
« Reply #6 on: May 16, 2018, 09:58:11 AM »
I am making a Black Box Project that I will put up on Git or Dropbox for download with instructions on how to add it to your project and then examples of how to use it.

Mikefly95

  • Jr. Member
  • **
  • Posts: 80
    • View Profile