Developing a PDMWorks Enterprise add

Download Report

Transcript Developing a PDMWorks Enterprise add

Developing a PDMWorks Enterprise add-in in Microsoft VB.NET

Jonathan Freeson Senior Consultant / Partner xLM Solutions, LLC

Overview  Programming with the PDMWE API  Development and Debugging Techniques – Using the VB.NET Example Program in the API Help File found on the PDMWE CD (API_GB.CHM) Note: There are hidden slides and slide notes in the deck that go into more detail in some areas.

API: Very Important Change in PDMWE 2008  Visual Basic 6 is no longer supported.

 VB6 applications upgrade to VB.NET Relatively Easily

API: Requirements  Suggest Microsoft .NET 2.0 Development Environment – Documentation has screenshots showing Visual Studio/Visual Basic 2002 which is .NET 1.0. – – – 64 Bit Support introduced in .NET 2.0

SQL 2005 uses .NET 2.0

Visual Basic 2005 and 2008 can target .NET 2.0

 Visual Basic Express Edition can be used in a limited fashion

Development : Getting Started – Creating The Project  Start Microsoft Visual Basic 2005 or 2008  Create a new “Class Library”

Development: Visual Basic 2008 Notes  Default target runtime is .NET 3.5

 .NET 2.0 is more common that 3.5 and is more likely to be installed on all clients. – Target should be changed to .NET 2.0

Environment Setup – Adding References  2007 and 2008 use the “EDMLIB” COM Library.

Environment Setup – Adding References  Adding the COM reference creates an “COM Interop Assembly” called “Interop.EdmLib.DLL”  This DLL is a wrapper/bridge between .NET and COM 

Very important

: The Interop.EdmLib.DLL that is automatically created must be deployed with the Add In DLL.

Environment Setup – Project Settings  In VB 2005 and 2008, mark Assembly as “COM-Visible.”

Writing Code – Implementing Interface  The class that is called from PDMWE must implement the EdmLib.IEdmAddIn5 interface.

Getting Started -- Interfaces  GetAddInInfo – Called by PDMWE to determine what the AddIn is capable of  Specifying which version of PDMWE is supported  Events to which it is subscribed  OnCmd – – Called whenever a subscribed event occurs Can abort/cancel certain operations

The API  Uses a lot of Object Orientated Programming (OOP) structures.

– – Not easily visible to the development environment Examples:  Multiple versions of same object exist. IEdmVault7 is compatible with IEdmVault6, IEdmVault5, etc.  An IEdmVault object can also be a IEdmVariableMgr5.  Well documented in the API_GB.CHM file found on the PDMWE CD. Good starting point.

Developing And Debugging  Using example from API_GB.CHM

Compiling And Deploying Test Version

Debugging  Up to now, everything could be done with “Express Editions” of Visual Basic.

 Debugging requires a full Visual Studio  PDMWE runs as part of Windows Explorer – – Use Visual Studio to Debug the “explorer.exe” process Usually requires explorer.exe to be killed so close important windows and save work  Tips: In windows, CTRL-SHIFT-ESCAPE brings up task manager – Can be used to start explorer.exe when it is killed and there is no task bar to right click on.

Debugging – Attaching to running explorer.exe

 Attach to running explorer.exe

Debugging – Create new explorer.exe

 Recommended: Kill existing explorer.exe then use debugger to start new one

Debugging Demonstration  Attaching to existing explorer.exe via the “Debug -> Attach Process” command  Configuring Visual Studio Project to start explorer.exe for debugging – Must kill explorer.exe before starting

Production Deployment  VERY Important to select ALL the .DLL files

Questions?

Contact Information  Jonathan Freeson – Managing Partner, xLM Solutions [email protected]

+1-517-579-9539  Slide materials and the VB.NET project file can be found at: http://www.xlmsolutions.com/sww2008