.NET Custom Command in Intergraph’s G/Technology (GDesigner)

Today I’m going to show you how to get a very simple Hello World dialog running in the Intergraph G/Technology (GDesigner). Even though this is a pretty simple application, many developers may not know where to start; the probable reason could be that the supplied help is not comprehensive enough at the first sight. I would like to thank Stephan Deckers from Merkator for helping me to bridge the same gap in the past. I am documenting the steps in a very simple manner so that you don’t have to go through the struggle to start .Net development in G/Technology.

Create a dialog in a C# class library

To start with – I used Visual Studio 2012 with G/Technology 10.01 installed on the same machine.

  1. Create new project

newprojhw

  1. Delete existing file which has a default class.

delclass1

  1. Add the references of G/Technology assemblies to the project as:

addref

Click on the Browse button in the Reference Manager.

Go to ..\Program Files (x86)\Intergraph\GTechnology\Program folder and select the following two references.

selref

Check them in the browse panel in the reference manager and click OK.

Make sure they appear in the references.

reftree

  1. Add a windows form to the project. I named it as HelloWorld.

addform

  1. Add a label on the form and set the properties as required.

Helloworlddialog

  1. Add a new class to the project and name it as HW_CCM.
  1. Open the code window of HW_CCM.
  1. Add the references of the assemblies at the top as

refheads

  1. Change the class to public class and implement the Interface IGTCustomCommandModal.

implementinterface

  1. Replace the Activate and TransactionManager methods as follows:

HWmethods

In Activate method you are creating the instance of the dialog box.

  1. You are now done. Now build the class library.

bldhw

bldhwresult

Deploy the class library

  1. Visit the output directory and copy the two files as shown below:

hwcopydll

  1. Note that you refer fileUNCPaths.xml and note the location for Customization node the two files above to the path. In my case its c:\myapp\bin.

xmlnode

Create a Metadata Entry in G/Technology

  1. Open GDesigner.
  1. Insert a new row to Custom Command in the Metadata Explorer.

HWMetadata

  1. Commit edits to the database and refresh Metadata Edits.
  1. Go to Tools->Customize menu.
  1. In Categories select Custom Commands and in Commands panel select the command (in my case it is MyCommand). Drag it to Tools Panel at the top and close.

Test the Dialogbox

  1. Click on the icon, you will see the Hello World dialog.

hwdiagingtch

With some additional coding, the following dialogue displaying the runtime information.

hwadvdiag

I hope this quick tutorial helps. The aim here wasn’t to delve into any huge depth, but provide a very quick “Getting started” application. Enjoy Coding smley