Help!

Persist toolbar visible state

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Program Add-Ins RSS
Next:  Murano Pendant !!!  
Author Message
Saeed
External


Since: Aug 12, 2009
Posts: 6



PostPosted: Wed Aug 26, 2009 4:06 am    Post subject: Persist toolbar visible state
Archived from groups: microsoft>public>outlook>program_addins (more info?)

I have added few buttons in a new toolbar using VSTO 2005, which I add during
the add-in startup. User can set its visibility using customize>toolbars. I
want to persist the state of toolbar i.e. if Outlook is closed when toolbar
was not visible, the toolbar should not be visible on next startup. For doing
this I am trying to keep the state of toolbar visibility in registry. Is
there an event of closing the outlook when I can read the state of toolbar
visibility and save it in registry? Add-in shutdown does not work as the
explorers are closed by that time.

Is there an standard way of doing this I mean not through registry?
Back to top
Ken Slovak - [MVP - Outlo
External


Since: Oct 17, 2003
Posts: 3355



PostPosted: Wed Aug 26, 2009 9:22 am    Post subject: Re: Persist toolbar visible state [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

You can persist the settings anywhere you want, for example in the user
settings for the addin or the registry or a file stored somewhere, that's up
to you.

Handle the Explorer.Close() event and get the visibility in that event
handler.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Saeed" <Saeed RemoveThis @discussions.microsoft.com> wrote in message
news:345609B6-9BF2-4D47-82A9-5A3BA3A59F00@microsoft.com...
>I have added few buttons in a new toolbar using VSTO 2005, which I add
>during
> the add-in startup. User can set its visibility using customize>toolbars.
> I
> want to persist the state of toolbar i.e. if Outlook is closed when
> toolbar
> was not visible, the toolbar should not be visible on next startup. For
> doing
> this I am trying to keep the state of toolbar visibility in registry. Is
> there an event of closing the outlook when I can read the state of toolbar
> visibility and save it in registry? Add-in shutdown does not work as the
> explorers are closed by that time.
>
> Is there an standard way of doing this I mean not through registry?
Back to top
Saeed
External


Since: Aug 12, 2009
Posts: 6



PostPosted: Wed Aug 26, 2009 9:22 am    Post subject: Re: Persist toolbar visible state [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks Ken. Can you please give me fully qualified namesapce for class
Explorer which you have mentioned. I could not find any class which provides
Close as event. I am using VSTO 2005 with C#.

"Ken Slovak - [MVP - Outlook]" wrote:

> You can persist the settings anywhere you want, for example in the user
> settings for the addin or the registry or a file stored somewhere, that's up
> to you.
>
> Handle the Explorer.Close() event and get the visibility in that event
> handler.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Saeed" <Saeed.DeleteThis@discussions.microsoft.com> wrote in message
> news:345609B6-9BF2-4D47-82A9-5A3BA3A59F00@microsoft.com...
> >I have added few buttons in a new toolbar using VSTO 2005, which I add
> >during
> > the add-in startup. User can set its visibility using customize>toolbars.
> > I
> > want to persist the state of toolbar i.e. if Outlook is closed when
> > toolbar
> > was not visible, the toolbar should not be visible on next startup. For
> > doing
> > this I am trying to keep the state of toolbar visibility in registry. Is
> > there an event of closing the outlook when I can read the state of toolbar
> > visibility and save it in registry? Add-in shutdown does not work as the
> > explorers are closed by that time.
> >
> > Is there an standard way of doing this I mean not through registry?
>
>
Back to top
Ken Slovak - [MVP - Outlo
External


Since: Oct 17, 2003
Posts: 3355



PostPosted: Wed Aug 26, 2009 4:26 pm    Post subject: Re: Persist toolbar visible state [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Where you have overloaded names such as the Close() method and the Close()
event you can usually use something like ExplorerEvents. I'd add that event
handler in C# using code something like this:

((Outlook.ExplorerEvents_Event)_expl).Close += new
Outlook.ExplorerEvents_CloseEventHandler(ExplClose);

_expl is an Explorer object declared at class level.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Saeed" <Saeed.TakeThisOut@discussions.microsoft.com> wrote in message
news:9B6D407F-22AE-42F9-9188-73BC86CCF09E@microsoft.com...
> Thanks Ken. Can you please give me fully qualified namesapce for class
> Explorer which you have mentioned. I could not find any class which
> provides
> Close as event. I am using VSTO 2005 with C#.
Back to top
Saeed
External


Since: Aug 12, 2009
Posts: 6



PostPosted: Wed Aug 26, 2009 4:26 pm    Post subject: Re: Persist toolbar visible state [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Ken,
I am able to get the event now. But the problem is not solved because by the
time of this event active explorer is closed and I do not get reference to
the toolbar to check if it was visible last time or not. Is there any event
for the case when use clicks customize toolbar and enables or disables any
toolbar. My whole aim is to keep my toolbar visibility as previous case i.e.
before outlook was closed.

"Ken Slovak - [MVP - Outlook]" wrote:

> Where you have overloaded names such as the Close() method and the Close()
> event you can usually use something like ExplorerEvents. I'd add that event
> handler in C# using code something like this:
>
> ((Outlook.ExplorerEvents_Event)_expl).Close += new
> Outlook.ExplorerEvents_CloseEventHandler(ExplClose);
>
> _expl is an Explorer object declared at class level.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Saeed" <Saeed.TakeThisOut@discussions.microsoft.com> wrote in message
> news:9B6D407F-22AE-42F9-9188-73BC86CCF09E@microsoft.com...
> > Thanks Ken. Can you please give me fully qualified namesapce for class
> > Explorer which you have mentioned. I could not find any class which
> > provides
> > Close as event. I am using VSTO 2005 with C#.
>
>
Back to top
Ken Slovak - [MVP - Outlo
External


Since: Oct 17, 2003
Posts: 3355



PostPosted: Thu Aug 27, 2009 9:11 am    Post subject: Re: Persist toolbar visible state [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

The Close() event should not be firing after the Explorer is already closed.
Your toolbar reference should be in place long before that event, you should
be getting and maintaining it when you create the UI.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Saeed" <Saeed.TakeThisOut@discussions.microsoft.com> wrote in message
news:97352612-0F02-4435-9C5E-1B273288C64B@microsoft.com...
> Hi Ken,
> I am able to get the event now. But the problem is not solved because by
> the
> time of this event active explorer is closed and I do not get reference to
> the toolbar to check if it was visible last time or not. Is there any
> event
> for the case when use clicks customize toolbar and enables or disables any
> toolbar. My whole aim is to keep my toolbar visibility as previous case
> i.e.
> before outlook was closed.
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Program Add-Ins All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum