Developing plugins in Visual Studio  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Developing plugins in Visual Studio

Postby DannyC » Fri May 21, 2021 3:54 pm

I know I'm a little late to the party but I'd like to get up to speed on using VS to develop plugins, custom forms, custom tabs etc. Up until now I've just been using the plugin maintenance screen. I've tried making headway previously but always got sidetracked with "proper" work!

So using this as a basis viewtopic.php?f=27&t=170 I thought I'd get stuck right in!
First hiccup came at step 2:
2. Copy all the Jiwa*.DLL files from your Jiwa installation into the output folder of the surrogate project (both projects in the surrogate solution output to the same folder)

When I unzip JiwaSurrogate I can't find any output folder in any subfolder anywhere.

Next hiccup is I can't find any free version of Infragistics for Windows Forms. The only trial versions seem to last for only 30 days and I can't find anything just for Windows Forms. The closest I can find is Ultimate UI for Windows Forms. But if I download & install the trial version will I still be able to develop & fiddle about & learn after day 31?

Third hiccup is at step 3.
3. Open the solution, and check the references are valid in both the JiwaSurrogate project and the Plugins project
How?

I'll see how far I get once I overcome those initial hurdles.

Thanks
User avatar
DannyC
Senpai
Senpai
 
Posts: 643
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Developing plugins in Visual Studio  Topic is solved

Postby SBarnes » Sun May 23, 2021 3:53 pm

Hi Danny,

As discussed separately note the following:

1. To add controls to a form you don't actually need the licensed controls you only need these if you are doing a form inside Visual Studio and require the WYSIWYG type scenario and doing a form from scratch, to add controls to a form there are examples provided by Jiwa in the plugin samples and you have actually been doing that when you add a button to the ribbon.

2. You don't actually need Visual Studio to do more heavy duty development, although there are certain circumstances under which a class library/ DLL might be a better option than the plugin editor, usually I found this to be for big projects where there could be a lot of classes such as an external api where there needs to be request and response classes that would clutter a plugin and one file is not the easiest option from a coding and maintenance point of view or a class library works for when you want to create code reuse, for example what you are writing might be used by Jiwa and an external executable, the only trick to remember with a class library is anything you want seen from outside the dll must be public and you must make the target X86. Usually if I have done a class library then I create a solution with my class library project and win forms project so I can dump buttons on the form to test my code and when the form loads up I have it login to Jiwa and it keeps a manager as a form variable to work with

3. To get Jiwa to work with Visual Studio is fairly simple if all you are doing is with the business objects you just need to add the Jiwa application dll and the jiwa odbc dll as references to the project and then any relevant dlls such as debtors if you are doing something with debtors or the inventory dll if its inventory, you can even add references to the Infragistics and spread/farpoint dlls if you are doing anything ui related that doesn't need WYSWYG such as adding a button to the ribbon. I usually add code to set an assembly resolver and pass in the Jiwa directory to this so there are no runtime issues see viewtopic.php?f=26&t=1510&p=6500&hilit=resolver#p6500 for an example of this.

4. If you are looking for an example of a full blown form with the necessary business objects take a look at viewtopic.php?f=32&t=1352 in this case I used our licensed versions of the controls in a win forms app to setup the screen that inherited from JiwaFinancials.Jiwa.JiwaApplication.Maintenance.UserInterface which is in Jiwa's application dll and then simply copied the designer code into the plugin once I had done that and wrote the code to hook everything up.

5. If you want to know what is necessary to create business objects Mike generously gave me the the details here viewtopic.php?f=26&t=474&p=1718&hilit=business+objects#p1718

6. If you wanted a simple learning exercise I would suggest you could try the following Mike wrote a simple list maintenance plugin found here viewtopic.php?f=27&t=498 go and create a completely different table with different fields, it doesn't matter what it is and see if you can convert the plugin to work with your table and your fields. I actually did this recently and Widgets became Web Tags in a couple of hours as largely I used Mike's plugin as a skeleton to start from rather than designing up a screen from scratch in Visual Studio as all I needed was similar functionality that is to maintain the look up table.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1645
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 182

Re: Developing plugins in Visual Studio

Postby pricerc » Sun May 23, 2021 9:12 pm

You can actually do quite a bit without using the Infragistics controls.

Unless you need specific functionality offered by them, you can usually just use standard Microsoft controls. As long as you don't mind them not being as pretty.

Or you can do all your external development using standard controls, and then just 'translate' them as part of the final bit of development for the plugin. I've done a couple like that - where I want to be able to easily figure out the UI in a sandbox outside of Jiwa, and then when it's finished, most of the controls are fairly trivial to replace with the Infragistics ones available within Jiwa.

For getting started, I actually ended up writing a plugin that exports a plugin to a Visual Studio project.

Attached for your entertainment.

It's a work in progress. And it comes with no guarantees, but it works for me.

The VB export is probably a bit more reliably than the C# export, simply because most of my plugins are in VB.

The idea is that you create your new plugin in Jiwa (or copy a standard one, if you're wanting to doctor it), and then use the "Export to Visual Studio" button in the 'Utilities' ribbon to save it. And then open up the resulting project in Visual Studio. It will have assembly information code file, and a 'meta file', and all the references that were in the Jiwa plugin. Embedded references will be saved as files. References to Jiwa DLLs should 'just work', but they don't copy them, it just points at the Jiwa directory.

You want to keep all your code in the main source code file, that you will copy-and-paste back in to the Jiwa plugin editor when you want to get it into Jiwa.

Getting code back into Jiwa is a whole other problem that I don't have a publishable solution for.

P.S. It's written in VB because of all the XML. Which VB is awesome at.
Attachments
Plugin Export Plugin to Visual Studio.xml
Plugin for exporting a plugin to a Visual Studio Project
(51.98 KiB) Downloaded 234 times
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 509
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20

Re: Developing plugins in Visual Studio

Postby DannyC » Mon May 24, 2021 11:30 am

Thanks Ryan & Stuart.
There's some good starting points there I can look into when time permits.
User avatar
DannyC
Senpai
Senpai
 
Posts: 643
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Developing plugins in Visual Studio

Postby VPEbits » Thu Jun 06, 2024 6:12 pm

Just to know that, can we use any visual studio version to debug and develop the plugin?
VPEbits
I'm new here
I'm new here
 
Posts: 1
Joined: Mon Jun 03, 2024 12:49 pm

Re: Developing plugins in Visual Studio

Postby Scott.Pearce » Thu Jun 06, 2024 6:16 pm

I use VS2019 x86 and VS2022 x64 without problem.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 746
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 223

Re: Developing plugins in Visual Studio

Postby SBarnes » Thu Jun 06, 2024 6:17 pm

Yes usually the following will launch the debugger if visual studio is installed on the machine

Code: Select all
System.Diagnostics.Debugger.Launch();
System.Diagnostics.Debugger.Break();
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1645
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 182


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 6 guests