AdvancedHMI Software
General Category => Tips & Tricks => Topic started by: Archie on May 26, 2015, 09:39:54 PM
-
Although AdvancedHMI is based on VB, it is very easy to use C#.
- Open the AdvancedHMI Solution with Visual Studio
- In the Solution Explorer, right click Solution 'AdvancedHMIv35' and select Add->New Project
- Add New Project dialog will pop up
- On the left, drill down Visual C#
- Select Windows Desktop
- On the right, select Windows Forms Application
- Give your project a name, then click OK
- Once the new project is in your solution, Right click the new C# project and select Add->Reference...
- The Reference Manager window will open. Drill down into Solution and select Projects
- Select all three projects in the list
- Click OK to close the Reference Manager
- Build the solution
- You can now add a driver from the Toolbox to your form, then add controls
-
Here's another way if you prefer.
Start your C# project
In Solution Explorer, right click the Solution name, select Add>Existing Project
Browse to wherever you unzipped the AdvancedHMI project
Add AdvancedHMIControls.vbproj and AdvancedHMIDrivers.vbproj
As soon as I added them, they popped up in the Toolbox
-
Here's another way if you prefer.
Start your C# project
In Solution Explorer, right click the Solution name, select Add>Existing Project
Browse to wherever you unzipped the AdvancedHMI project
Add AdvancedHMIControls.vbproj and AdvancedHMIDrivers.vbproj
You have to be careful with this technique because it splits the solution across multiple folders. This makes it more difficult to distribute the complete solution because the end user will have to have the same directory setup. Also if the original extracted AdvancedHMI solution is moved or deleted, it breaks the C# solution.
-
I've tried with the second option, creating a new c# Project and then adding the VB Project for the Drivers and Controls... After building the Solution the Toolbars just popped up, but there are some objects missing in the AdvancedHMIDrivers Toolbar like the SerialDF1forSLCMicroCom
Anyone knows why this happened?
-
Are you using Visual Studio 2015?
http://advancedhmi.com/forum/index.php?topic=1266.0
-
Here's another way if you prefer.
Start your C# project
In Solution Explorer, right click the Solution name, select Add>Existing Project
Browse to wherever you unzipped the AdvancedHMI project
Add AdvancedHMIControls.vbproj and AdvancedHMIDrivers.vbproj
You have to be careful with this technique because it splits the solution across multiple folders. This makes it more difficult to distribute the complete solution because the end user will have to have the same directory setup. Also if the original extracted AdvancedHMI solution is moved or deleted, it breaks the C# solution.
Just got back to this...
After I added the AdvancedHMI projects as I describe, then under the References section I have:
AdvancedHMIControls
AdvancedHMIDrivers
and a few others.
Highlighting any of these shows that the Copy Local is set to true. So when I build, in the bin folder I get my exe and a few dlls. I copied the exe and dlls into a folder on my target machine and my application runs just fine.
-
Yes, genius your copy may run just fine, but what about someoone else need to make a change later on with his laptop, then what?
-
Simple. You set up your development machine like this:
MyProject\AdvancedHMI
then you commit your project to your source code control system. Now anyone can pull that code from the repo, build, and they will get the same output files on any machine and can deploy to the target machine in the same manner. Need to make a change? Pull from repo, build new exe and xcopy to target.
I know it is common to have your complete build environment on the target machine but this may not always be feasible, possible, etc. I work in the highly regulated medical device industry and if you had the build tools and source codes on your target machine, where anyone could walk up and make changes to a validated piece of production equipment, that could get you shut down.
Same thing if the target machine dies, you need to have documentation on how to reproduce the system.
-
I never said you need to have the source code in the tartget machine which is normally on the shop floor.
-
If EE_Kraig's approach works then some users might find it acceptable and some might not.
-
Simple. You set up your development machine like this:
MyProject\AdvancedHMI
then you commit your project to your source code control system. Now anyone can pull that code from the repo, build, and they will get the same output files on any machine and can deploy to the target machine in the same manner. Need to make a change? Pull from repo, build new exe and xcopy to target.
I know it is common to have your complete build environment on the target machine but this may not always be feasible, possible, etc. I work in the highly regulated medical device industry and if you had the build tools and source codes on your target machine, where anyone could walk up and make changes to a validated piece of production equipment, that could get you shut down.
Same thing if the target machine dies, you need to have documentation on how to reproduce the system.
See: http://advancedhmi.com/forum/index.php?topic=1402.msg7606#msg7606
In short:
The licensing also requires distribution of the complete solution source code to the end user.
In other words: if you don't distribute the full source code with your product, you are violating the license. They claim the reason for that is because if in the future an engineer wants to modify the program, they can immediately do so. I proposed that that article of the license be reviewed and maybe changed to something like "must give credit". But it is ultimately the author's choice and we must respect that - he is the one that put in all the hours to develop this project and decided to open source it!
-
Can't you provide a USB stick to your end customer with the full solution and just deploy the necessary files onto the target machine and still meet the license??
Actually, I just reread the FAQ on licensing. This should be perfectly acceptable.
-
I've tried with the second option, creating a new c# Project and then adding the VB Project for the Drivers and Controls... After building the Solution the Toolbars just popped up, but there are some objects missing in the AdvancedHMIDrivers Toolbar like the SerialDF1forSLCMicroCom
Anyone knows why this happened?
In regarding to the missing driver problem, I am not sure that it's VS 2015 fault since I can consistently add driver from 399a without any problem.
VS 2015 update 1 did not fix it. I downloaded update 3, and the problem still there. And now I am downloading 2017 RC. It's still downloading at 11.2 GB :=(.
Archie, why version a works?
-
To make things easier for those that prefer C#, version 3.99s now comes with a pre-configured C# projects.
-
In the interest of completeness in case anyone uses this method, updated procedure.
Start your C# project
In Solution Explorer, right click the Solution name, select Add>Existing Project
Browse to wherever you unzipped the AdvancedHMI project
Add the following (I did it in this order):
AdvancedHMI.vbproj
AdvancedHMIControls.vbproj
AdvancedHMIDrivers.vbproj
Right-click on AdvancedHMI and Build.
After this, the toolbox gets populated (I did have to close and restart VS one time to get the Drivers to pop up).
-
To make things easier for those that prefer C#, version 3.99s now comes with a pre-configured C# projects.
Thumbs Up for that!
LG