Switching Forms in ReadingPane Region

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

Switching Forms in ReadingPane Region
 
Domink Sierpowski




Posts: 1
Joined: 2016-11-28
Hi,

I've got a question about using Reading Pane Region "On demand"
I read your article about customizing Outlook Regions.
https://www.add-in-express.com/add-in-net/outlook-regions.php

For my form I've choosen "Outlook Reading Pane regions on demand - ReadingPane"

Here is my code from AddinModule.Designer.cs:

      
            private AddinExpress.OL.ADXOlFormsCollectionItem filePane1;
            public AddinExpress.OL.ADXOlFormsManager formsMan1;
            this.formsMan1 = new AddinExpress.OL.ADXOlFormsManager(this.components);
            this.filePane1 = new AddinExpress.OL.ADXOlFormsCollectionItem(this.components);
            // formsMan1
            this.formsMan1.Items.Add(this.filePane1);
            this.formsMan1.ADXFolderSwitchEx += new                      AddinExpress.OL.ADXOlFormsManager.FolderSwitchEx_EventHandler(this.formsMan1_ADXFolderSwitchEx);
            this.formsMan1.SetOwner(this);
            // filePane1
            this.filePane1.AlwaysShowHeader = true;
            this.filePane1.Cached = AddinExpress.OL.ADXOlCachingStrategy.OneInstanceForAllFolders;
            this.filePane1.ExplorerLayout = AddinExpress.OL.ADXOlExplorerLayout.ReadingPane;
            this.filePane1.FolderName = "*";
            this.filePane1.FormClassName = "TF.FileServer4.Client.OutlookAddin.FilePane";
            this.filePane1.UseOfficeThemeForBackground = true;


And I would like to switch between my form and Outlook default view Reading Pane on SelectionChangedEvent in my another form.


private async void listView1_SelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            ...
        }


How can I do it?
Thanks in advance for help :)
Posted 28 Nov, 2016 06:49:26 Top
Andrei Smolin


Add-in Express team


Posts: 18810
Joined: 2006-05-11
Hello Domink,

To show your form, you call ADXOlForm.Activate(). To show the reading pane, call ADXOlForm.ActivateStandardPane().

Domink Sierpowski writes:
private async void listView1_SelectionChanged


Please be aware that a lot of issues may occur if you invoke an await operator with ConfigureAwait(false) in the code of the event handler: 1) this creates a different thread while the all object models in Office are thread-unsafe; 2) in addition, the code will be executed in a context that may differ from the context in which the operation was originally invoked. Context change may be almost anything: a window created/shown/hidden/destroyed, the selection changed, etc. I strongly believe using SendMessage/OnSendMessage (see section Wait a Little in the PDF file in the folder {Add-in Express}\Docs on your development PC) and performing all activity while handling a custom message is far safer than using async/await.


Andrei Smolin
Add-in Express Team Leader
Posted 28 Nov, 2016 08:44:29 Top