Joseph S
Posts: 10
Joined: 2015-12-28
|
In my add-in, I created a form at the top of the inspector window that has a webbrowser component. In the web component it displays information about the open or read e-mail.
Also when the reading pane is open, it will also show the form.
The issue:
When selecting a new item in the explorer window, it should update the reading pane window, and form, and display the proper information in the ADXForm about that e-mail. (This works)
But what happens, is if any other e-mails are also open, it will change the webbrowser component to the selected item in the explorer, and not leave it as the open e-mail.
I am trying to figure out what the best way is to implement the process so that:
- When an item is selected in the explorer it will only update the reading pane message, and ADXForm
- When I open a message, it will populate the form with the information from the message, but it will not change.
Where is the best place to do this?
I am doing this currently under ExplorerSelectionChange, but I figure this might be my problem, and the wrong place to change the form info:
Outlook.OlPane o = Outlook.OlPane.olPreview;
if (currExplorer.IsPaneVisible(o))
{
foreach (AddinExpress.OL.ADXOlFormsCollectionItem itemForm in adxOlFormsManager1.Items)
{
switch (itemForm.ExplorerLayout)
{
case AddinExpress.OL.ADXOlExplorerLayout.BottomNavigationPane:
case AddinExpress.OL.ADXOlExplorerLayout.BottomOutlookBar:
case AddinExpress.OL.ADXOlExplorerLayout.BottomReadingPane:
case AddinExpress.OL.ADXOlExplorerLayout.BottomSubpane:
case AddinExpress.OL.ADXOlExplorerLayout.BottomTodoBar:
case AddinExpress.OL.ADXOlExplorerLayout.TopReadingPane:
for (int i = 0; i < itemForm.FormInstanceCount; i++)
{
ADXOlFormNotice frm = itemForm.FormInstances(i) as ADXOlFormNotice;
if (frm != null)
{
string NoticeFile = folderASPMCacheNotice + selectedMailItemKey + "_region.html";
if (File.Exists(NoticeFile))
{
frm.urlString = NoticeFile;
frm.Text = "Message: (" + selectedMailItemKey + ")";
//frm.Icon = Properties.Resources.env_blue_forward_128x128;
frm.gotoPage(NoticeFile);
}
else
{
NoticeFile = folderASPMCacheNotice + selectedMailItemKey + "_region.html";
frm.Text = "Message: (" + selectedMailItemKey + ")";
}
}
}
break;
case AddinExpress.OL.ADXOlExplorerLayout.TopSubpane:
case AddinExpress.OL.ADXOlExplorerLayout.LeftReadingPane:
case AddinExpress.OL.ADXOlExplorerLayout.LeftSubpane:
case AddinExpress.OL.ADXOlExplorerLayout.RightReadingPane:
case AddinExpress.OL.ADXOlExplorerLayout.RightSubpane:
case AddinExpress.OL.ADXOlExplorerLayout.Unknown:
case AddinExpress.OL.ADXOlExplorerLayout.WebViewPane:
break;
}
}
}
Thoughts? Help? |
|
Andrei Smolin
Add-in Express team
Posts: 18829
Joined: 2006-05-11
|
Hello Joseph,
You can use an event of the from instance itself, not in an event of Outlook. Say, if ADXOlForm.InspectorObj is *not* null in the ADXOlForm.ADXBeforeFormShow event, you can cast it to Outlook.Inspector, retrieve the item, and setup the webbrowser component.
Andrei Smolin
Add-in Express Team Leader |
|
Joseph S
Posts: 10
Joined: 2015-12-28
|
That worked great, here is the code:
try
{
if (this.InspectorObj != null)
{
switch (this.Item.InspectorLayout)
{
case AddinExpress.OL.ADXOlInspectorLayout.BottomSubpane:
case AddinExpress.OL.ADXOlInspectorLayout.TopSubpane:
if (webBrowser1.Document == null || webBrowser1.Document.Body.ToString() == String.Empty)
{
// load web page here
}
else
{
}
break;
case AddinExpress.OL.ADXOlInspectorLayout.LeftSubpane:
case AddinExpress.OL.ADXOlInspectorLayout.RightSubpane:
//this.Width = 100;
break;
case AddinExpress.OL.ADXOlInspectorLayout.Unknown:
break;
}
}
}
catch (Exception eMsg)
{
}
|
|