Forms region settings to display form in explorer preview AND inspector

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

Forms region settings to display form in explorer preview AND inspector
 
Niels Ziegler




Posts: 49
Joined: 2017-02-03
The information I need is just not available on BeforeFormShow.

I followed some of the events when moving from the inbox to the draft folder. This is the sequence I get



  • AddinModule - ExlorerViewSwitch Form
  • Form - BeforeShow
  • Form -AfterShow
  • AddinModule - ExplorerSelectionChange
  • Form - SelectionChange
  • AddinModule - ExplorerSelectionChange
  • Form - SelectionChange
  • AddinModule - ExplorerInlineResponseEx


Only at the last event of this list is the information about the InlineEditor available to me. On the second ExplorerSelectionChange, I can get the selected item, but no Inlineditor information at that point.
Posted 23 Jun, 2017 05:57:17 Top
Andrei Smolin


Add-in Express team


Posts: 14140
Joined: 2006-05-11
Hello Niels,

Check if the code below works for you.

Form:

private void ADXOlForm1_ADXBeforeFormShow()
{
    try
    {
        if (this.InspectorObj == null) // in Explorer only
        {
            rhis.Visible = IsInlineResponse();
        }
    }
    catch (Exception ex)
    {
        Logger.AddException("ADXBeforeFormShow", ex);
    }
}
private bool IsInlineResponse()
{
    if (this.ExplorerObj == null) return false;
    bool result = false;
    Outlook.Explorer explorer = this.ExplorerObj as Outlook.Explorer;
    object inlineResponse = explorer.ActiveInlineResponse;
    if (inlineResponse != null)
    {
        Marshal.ReleaseComObject(inlineResponse);
        result = true;
    }
    return result;
}


Module:

//
// adxOlFormsCollectionItem2
//
this.adxOlFormsCollectionItem2.ExplorerItemTypes = AddinExpress.OL.ADXOlExplorerItemTypes.olMailItem;
this.adxOlFormsCollectionItem2.ExplorerLayout = AddinExpress.OL.ADXOlExplorerLayout.LeftReadingPane;
this.adxOlFormsCollectionItem2.FormClassName = "TestAddin.ADXOlForm1";


private void adxOutlookEvents1_ExplorerInlineResponseEx(object sender, object itemObject, object sourceObject) {
    AddinExpress.OL.ADXOlForm form = this.adxOlFormsCollectionItem2.GetForm(sourceObject);
    if (form != null) {
        form.Show();
    }
}

private void adxOutlookEvents1_ExplorerInlineResponseCloseEx(object sender, object sourceObject) {
    AddinExpress.OL.ADXOlForm form = this.adxOlFormsCollectionItem2.GetForm(sourceObject);
    if (form != null) {
        form.Hide();
    }
}


Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 23 Jun, 2017 09:54:33 Top
Niels Ziegler




Posts: 49
Joined: 2017-02-03
Since the forms are mutually exclusive, I got it to work as displayed below.

There is one minor thing left. When I switch to a draft mail item, both forms seems to be displayed for a short time, then the InlineResponseEx event hides the informational form. I tried quite a few events before inlineResponse to hide it, but it seems that the form is forced to be displayed at least once. I only managed to get it to NOT display at all.


   private void OutlookEventManager_ExplorerInlineResponseEx(object sender, object itemObject, object sourceObject)
        {
            AddinExpress.OL.ADXOlForm classificationForm = this.ClassificationForm.GetForm(sourceObject);
            if (classificationForm != null)
            {
                classificationForm.Show();
            }
            AddinExpress.OL.ADXOlForm infoForm = this.ClassificationInfoForm.GetForm(sourceObject);
            if (infoForm != null)
            {
                infoForm.Hide();
            }
        }

        private void OutlookEventManager_ExplorerInlineResponseCloseEx(object sender, object sourceObject)
        {
            AddinExpress.OL.ADXOlForm classificationForm = this.ClassificationForm.GetForm(sourceObject);
            if (classificationForm != null)
            {
                classificationForm.Hide();
            }
            AddinExpress.OL.ADXOlForm infoForm = this.ClassificationInfoForm.GetForm(sourceObject);
            if (infoForm != null)
            {
                infoForm.Show();
            }
        }
Posted 25 Jun, 2017 05:57:21 Top
Andrei Smolin


Add-in Express team


Posts: 14140
Joined: 2006-05-11
Hello Niels,

Niels Ziegler writes:
When I switch to a draft mail item, both forms seems to be displayed for a short time,


The first form is shown by default; the second one is shown by your code; while the code handles hiding the first form, you see two of them. this is because showing/hiding a form is a resource consuming operation. To bypass this issue, you can use the fact that you *always* have a form shown in the Reading Pane. Instead of showing/hiding two forms, you could use one form and two UserControls on it. The UserControls can hold two sets of controls and your code can show/hide the UserControls when required.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 26 Jun, 2017 04:10:18 Top