AdvancedHMI Software

General Category => Open Discussion => Topic started by: GraemeTownsend on March 28, 2017, 01:05:37 AM

Title: IP traffic with multiple windows forms
Post by: GraemeTownsend on March 28, 2017, 01:05:37 AM
Hi,

I'm looking at a project with potentially a lot of I/O. I am building the HMI to have several Windows forms that I Show/Hide to manage the layout.

Question:
- Will the Basic Labels and Indicators continue to poll the PLC(s) even when not visible?

Cheers,
Graeme.
Title: Re: IP traffic with multiple windows forms
Post by: Archie on March 28, 2017, 05:46:53 AM
It depends. If you copy the following code snippet to each form, they wil not:
Code: [Select]
    '*******************************************************************************
    '* Stop polling when the form is not visible in order to reduce communications
    '* Copy this section of code to every new form created
    '*******************************************************************************
    Private NotFirstShow As Boolean

     Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
        '* Do not start comms on first show in case it was set to disable in design mode
        If NotFirstShow Then
            AdvancedHMIDrivers.Utilities.StopComsOnHidden(components, Me)
        Else
            NotFirstShow = True
        End If
    End Sub
Title: Re: IP traffic with multiple windows forms
Post by: GraemeTownsend on March 28, 2017, 06:52:34 PM
Thanks Archie.