VSTO Pain Exchange ForumVSTO Pain Exchange ForumDiscussionsDiscussionsVSTO - OutlookVSTO - OutlookExample of use for WrappersExample of use for Wrappers
Previous Previous
 
Next Next
New Post
 10/11/2008 2:46 AM
 
Example of use for Wrappers  (United States)

Helmut, I've done a lot of small Outlook development over the years but I usually wrote code directly in IDTExtensibility or VSTO classes, and I've never had to write anything complex for inspectors. So I never looked close at your wrapper classes until today. I'm working on a project that requires adding buttons to the new/reply to email inspector. I understand the wrappers, but I'm wondering why someone would want to put code in a wrapper.  Can you provide a couple case examples where this would be helpful?  As an example, when a user launches a Reply window I need to provide a button to allow them to get information from a server.  Why would I wrap the inspectors when they're opened rather than adding buttons more "directly"?

I'm guessing that rather than just having a general purpose InspectorWrapper, that you expect developers to create specific InspectorWrappers, like in my case ServerInfoInspector?  Then when an Inspector is launched we can add it to one or even more specific-purpose wrappers to have each operate on it as necessary.

LOL - have I answered my own question or do you have better examples?  Thank you very much.

New Post
 10/11/2008 9:39 PM
 
Re: Example of use for Wrappers  (United States)

For anyone reading this, I did exactly what I guessed above and it's working perfectly.  The application-specific functionality is encapsulated in a wrapper rather than putting it up in the addin-level code.  A couple things confused me but I fixed them:

When creating CommandButtons, assign a unique ID to all buttons, otherwise a user that has two inspectors up will see an event firing for every button with the same name each time they click a button. I used the local _inspector.Id+"B1" for button1, etc.  The Id is a Guid that's generated when the Inspector is launched.

CommandBar objects don't seem to be destroyed with the wrapped objects that create them. So when adding items to a menu/toolbar from an inspector or explorer, you need to make sure a CommandBar doesn't exist before you create it. I haven't looked into the detail of why buttons are global but commandbars are not. I'll do this soon.

Helmut, you're on my short list of people to contact for paid consulting if I get stuck in this area.  Thanks again.

 

New Post
 10/30/2008 6:04 PM
 

Hello Starbuck:

Why someone need to use Wrappers for Inspectors?

Thanswer is:

Because A User can have multiple Windows Open and Closed at any time. You need a way to identify your Windows.
It's easier to create different Wrappers for different kind of Outlook-Windows - like ContactItem, TaskItem etc.

It's also easier to avoid Memoryleaks and do Tracing in case of Errors.

It's just an approach to write more robust Outlook Extensions.

 

Hope this helps, Greets-Helmut

 

Previous Previous
 
Next Next
VSTO Pain Exchange ForumVSTO Pain Exchange ForumDiscussionsDiscussionsVSTO - OutlookVSTO - OutlookExample of use for WrappersExample of use for Wrappers

Newsgroups
Minimize 
 TitleDescription
Outlookcode.com - Everything from VBA to .NetOutlookCode.com is a meeting place for people who want to make Outlook work harder for themselves and their organizations by learning how to program applications for their own use and to share with others.
MSDN Forums - Visual Studio Tools for OfficeQuestions on using Visual Studio to create managed code solutions in Office 2003 and Office 2007.
  
HouseMenu
Minimize 
    FAQ  |  HowTo's  |  Books  |  Tools  |  Websites  |  Technology  |  Blogs  |  Newsfeeds  |  Discussion