advanced smarteam programming

22
Advanced SmarTeam Programming Marc Young CEO xLM Solutions, LLC

Upload: boyce

Post on 09-Jan-2016

148 views

Category:

Documents


7 download

DESCRIPTION

Advanced SmarTeam Programming. Marc Young CEO xLM Solutions, LLC. Overview. SmarTeam and .NET 2.0 Configuring Visual Studio Developing and Debugging a User Defined Tool Windows Client Web Client. SmarTeam and .NET 2.0. SmarTeam currently a .NET 2.0 Application - PowerPoint PPT Presentation

TRANSCRIPT

Advanced SmarTeam ProgrammingMarc Young

CEO

xLM Solutions, LLC

OverviewOverview

• SmarTeam and .NET 2.0• Configuring Visual Studio• Developing and Debugging a User Defined Tool

• Windows Client• Web Client

SmarTeam and .NET 2.0SmarTeam and .NET 2.0

• SmarTeam currently a .NET 2.0 Application• .NET 2.0 minimum supported runtime• Visual Studio 2005 and 2008 can target the .NET 2.0

environment

Configuring EnvironmentConfiguring Environment

• SmarTeam Primary “Interop” Assemblies (PIA’s)• Copy from Global Assembly Cache (GAC) to make

referencing easier• Optionally add copy folder to Visual Studio’s

reference search path (HKLM\Software\Microsoft\.NETFramework\AssemblyFolders on 32 bit windows)

User Defined ToolUser Defined Tool

• Simple BOM Tree Report• Runs on an Assembly in SmarTeam• Generates a simple text file • Will write in VB.NET

• More people understand VB.NET • Counterpoint example to the C# code provided in

documentation

Creating ProjectsCreating Projects

• Personally prefer two projects• Class Library Project

• Contains business logic • Entry point of Windows client code• Exposes a COM compatible interface for SmarTeam

script engine (COM Interop)• ASP.NET Web Application Project

• Contains code to support web • Project type not available in original VS2005. Either

need latest service pack or additional project template from Microsoft Web Site

Project ReferencesProject References

• Both Projects• SmarTeam.Std.Interop.SmarTeam.SmApplic• SmarTeam.Std.Interop.SmarTeam.SmRecList

• Web Project• SmarTeam.Std.Applications.WebEditor.dll (found in

SMARTEAM\WebEditor\web\Bin)• SmarTeam.Std.Foundation.Specialized• SmarTeam.Std.Foundation

Project ReferencesProject References• Tip: Change Copy Local

and Specific Version to False. Makes it easier to recompile on newer versions of SmarTeam.

Tips for Creating a Windows CustomizationTips for Creating a Windows Customization

• As SmarTeam’s scripting engine is COM based, the .NET library must expose a Com interface.

• VB.NET comes with a template for COM classes• C# is a bit more complicated but you have finer control on

what happens. • Advanced Tip: By default in VS2005, all classes are set

with ComVisible = True. • Prefer to update the AssemblyInfo.vb (via UI or direct edit) to

set this to false and explicitly expose the classes.

VB.NET COM Class TemplateVB.NET COM Class Template

Debugging Windows CustomizationDebugging Windows Customization

• Code is written, time to debug• Technique will not work with any Express Edition of

Visual Studio• Requires Remote Debugging• Express Editions do not have it

Debugging Windows ClientDebugging Windows Client

• Configure Debugger• Set Breakpoints• Run Code

Configuring for DebuggingConfiguring for Debugging• Configure the Library to start SmarTeam.exe when

debugging starts

Windows Client Debugging Example

Web Customization Code OverviewWeb Customization Code Overview

• Start with an ASP.NET Web Application• Write ASPX files• Copy ASPX files to proper locations• Copy compiled DLLs to <SMARTEAMHOME>\

WebEditor\web\bin• Important: Restart SmarTeam web editor (easist to

just run IISReset)• Start Debugging

Creating a User Defined ToolCreating a User Defined Tool

• Example UDT is in <SMARTEAMHOME>\WebEditor\web\Views\UserDefinedTools\UserDefinedToolDemo1.aspx

• Example written in C#• Example is a completely self-contained ASPX file. It

does not have external DLLs.• Self-contained is easier to deploy, but more difficult

to write.

Web User Defined Tools TipsWeb User Defined Tools Tips

• JavaScript is required in most Web Editor customizations due to the need to change the contents of a specific target frame.

• Sample page defines some JavaScript functions but are written in a way that does not lend itself to compiled code

• Example JavaScript can be used as starting place for versions seen in this sample.

Web Debugging LimitationsWeb Debugging Limitations

• Every time you make a change to the code and roll out to web server, SmarTeam Web Editor needs to be restarted.

• Must attach debugger to a running aspnet_wp.exe (XP) or w3wp.exe (Win2003) process

• Dynamically changing code as it runs is not possible because of attaching and not running code inside of Visual Studio.

RecapRecap• Web and Windows client customization can share the

same business logic • User interface/user interaction code is very different• Windows client customziation requires knowledge of

COM/VB.NET/.NET Programming• Web client customization requires knowledge of the same

as windows plus ASP.NET. JavaScript knowledge helps.

Thank Thank You!You!

QuestiQuestionsons??

Marc YoungxLM Solutions, [email protected]

This presentation and example shown are available at: http://www.xlmsolutions.com/presentations/COE2009