Show/Hide Panel (ADX Extensions for Outlook)

Add-in Express™ Support Service
That's what is more important than anything else

Show/Hide Panel (ADX Extensions for Outlook)
 
mitchel c




Posts: 20
Joined: 2006-05-07
How can I show/hide a panel from the Selection change event? I want to only show it for some mail items based on a special header...

Thanks!
Posted 04 Jun, 2006 02:24:27 Top
Fedor Shihantsov


Add-in Express team


Posts: 1188
Joined: 2005-01-11
Mitchel,

Please, add Events (AddinExpress.MSO.ADXOutlookAppEvents) component to AddinModule.
And use the following code in ExplorerSelectionChange handler.


private void adxOutlookEvents_ExplorerSelectionChange(object sender, object explorer)
{
    Outlook.Selection selection = null;
    Outlook.MailItem mailItem = null;
    try
    {
        selection = (explorer as Outlook.Explorer).Selection;
        if (selection.Count == 1)
        {
            if (selection[1] is Outlook.MailItem)
            {
                mailItem = selection[1] as Outlook.MailItem;
                adxOlFormsManager1.Items[0].Enabled = (mailItem.Subject == "MySubject");
            }
        }
    }
    finally
    {
        if (selection != null)
            Marshal.ReleaseComObject(selection);
        if (mailItem != null)
            Marshal.ReleaseComObject(mailItem);
    }
}


Note, this will result in creation of a new form instance for every SelectionChange event. So, you need to keep your data (if any) somewhere else.
Posted 05 Jun, 2006 08:03:19 Top