Author Topic: Avionics Instruments Controls (VB .Net version)  (Read 7902 times)

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Avionics Instruments Controls (VB .Net version)
« on: September 01, 2019, 01:04:36 AM »
Thanks to the original project by Guillaume CHOUTEAU, which can be found here:

https://www.codeproject.com/Articles/27411/C-Avionic-Instrument-Controls

- Download and extract the attached 7z file (2 new folders will be created: "Resources" and "AvionicsInstrumentControls").
- Add images from the "Resources" folder as existing items to the AdvancedHMIControls project resources.
- Create a new folder inside the AdvancedHMIControls project's "PurchasedControls" folder, name it "AvionicsInstrumentControls" and add to it as existing items all the controls found in the same folder you downloaded.
- Rebuild the solution and these new controls should show in the ToolBox.

Besides for the InstrumentControl, which is a base control, all other controls are AHMI controls.
You could prevent this base control from showing in the Toolbox by adding "MustInherit" after the "Public" word.

If you try to provide values manually then remember this, in case your value is a string:
 
* AttitudeIndicatorInstrumentControl - PitchAngle and RollAngle are declared as Double so use CDbl(yourvalue)
* AirSpeedIndicatorInstrumentControl - AirSpeed  is declared as Integer so use CInt(yourvalue)
* AltimeterInstrumentControl - Altitude is declared as Integer so use CInt(yourvalue)
* HeadingIndicatorInstrumentControl - Heading is declared as Integer so use CInt(yourvalue)
* TurnCoordinatorInstrumentControl - TurnQuality and TurnRate are declared as Single so use CSng(yourvalue)
* VerticalSpeedIndicatorInstrumentControl - VerticalSpeed is declared as Integer so use CInt(yourvalue)


These controls were also discussed in this topic: https://www.advancedhmi.com/forum/index.php?topic=2488.0
« Last Edit: March 05, 2020, 09:40:12 PM by Godra »

joko markono

  • Full Member
  • ***
  • Posts: 132
    • View Profile
Re: Avionics Instruments Controls (VB .Net version)
« Reply #1 on: September 02, 2019, 04:14:29 AM »
Hi Godra,

May i know where is this "project resources"? I can only see a Resources folder under the AdvanceHMI project.
 "Add images from the "Resources" folder as existing items to the AdvancedHMIControls project resources."

If i add all the images into the folder i mentioned, i will get a lot of errors after rebuild.



Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Avionics Instruments Controls (VB .Net version)
« Reply #2 on: September 02, 2019, 05:01:32 PM »
See the attached picture.

You right-click the AdvancedHMIControls project, click Properties and then select Resources.
The Resources window will probably show "Strings" so you need to change it to "Images" by clicking the small arrow next to it.
Then click the small arrow next to "Add Resource" and choose "Add Existing File" to browse to the files you downloaded.
« Last Edit: September 02, 2019, 05:42:29 PM by Godra »

joko markono

  • Full Member
  • ***
  • Posts: 132
    • View Profile
Re: Avionics Instruments Controls (VB .Net version)
« Reply #3 on: September 02, 2019, 09:28:36 PM »
I think i've don't correctly now but there is one more issue with the GetComComponent as in pisture. How do i solve this.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Avionics Instruments Controls (VB .Net version)
« Reply #4 on: September 02, 2019, 09:42:03 PM »
What version of AdvancedHMI are you using?

Can you try using the latest beta version?

Eventually, you might try adding this function to your Utilities file inside the AdvancedHMIDrivers/Common folder (hopefully without any errors):

Code: [Select]
    '*********************************************************************
    '* Used to set the ComComponent property in design mode
    '* If one doesn't exist, add a CLX driver
    '*********************************************************************
    Public Shared Function GetComComponent(ByVal container As ComponentModel.IContainer) As MfgControl.AdvancedHMI.Drivers.IComComponent
        If container Is Nothing Then Return Nothing

        Dim Result As MfgControl.AdvancedHMI.Drivers.IComComponent = Nothing
        '********************************************************
        '* Search for AdvancedHMIDrivers.IComComponent component in parent form
        '* If one exists, set the client of this component to it
        '********************************************************
        Dim ItemIndex As Integer
        Dim ContainerComponentCount As Integer = container.Components.Count
        While Result Is Nothing And ItemIndex < ContainerComponentCount
            'If Me.Site.Container.Components(ItemIndex).GetType.GetInterface("IComComponent") IsNot Nothing Then
            If AdvancedHMIDrivers.Utilities.IsImplemented((container.Components(ItemIndex).GetType), GetType(MfgControl.AdvancedHMI.Drivers.IComComponent)) Then
                Result = CType(container.Components(ItemIndex), MfgControl.AdvancedHMI.Drivers.IComComponent)
            End If
            ItemIndex += 1
        End While

        '************************************************
        '* If no comm component was found, then add one and
        '* point the ComComponent property to it
        '*********************************************
        If Result Is Nothing Then
            Result = New AdvancedHMIDrivers.EthernetIPforCLXCom(container)
        End If

        Return Result
    End Function

Just copy the above code and paste it in the Utilities file.

joko markono

  • Full Member
  • ***
  • Posts: 132
    • View Profile
Re: Avionics Instruments Controls (VB .Net version)
« Reply #5 on: September 02, 2019, 09:58:49 PM »
I downloaded the latest version 399ybeta33 but i can't create a folder inside the Purchased Control folder.
It says "The system cannot find the path specified"

So i added a sub folder inside the Controls folder. I rename the new folder as AvionicsInstrumentControls and now i have no error. All controls i can drag from the toolbox now.
« Last Edit: September 02, 2019, 10:06:16 PM by joko markono »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Avionics Instruments Controls (VB .Net version)
« Reply #6 on: September 02, 2019, 10:13:04 PM »
That sounds like all your issues are resolved currently.

joko markono

  • Full Member
  • ***
  • Posts: 132
    • View Profile
Re: Avionics Instruments Controls (VB .Net version)
« Reply #7 on: September 03, 2019, 04:20:48 AM »
yes, so far so good. Thanks Godra.