ADXolform is initiating twice

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

ADXolform is initiating twice
First time when I switch folder from Inbox to other folder, ADXolForm is initializing again 
Lokesh Sharma




Posts: 18
Joined: 2020-03-15
Hi Andrei,



I have noticed that when I am changing folder very first time (from inbox to sent items). My form is getting initialized again and I am able to see same control twice. It is happening only first time when I change folder, in subsequent changes it is working fine. What can I do to use singleton kind of pattern so it should not initialize again?

[lsADXOlFormItem = new ADXOlFormsCollectionItem();
lsADXOlFormItem.ExplorerLayout = ADXOlExplorerLayout.RightReadingPane;
lsADXOlFormItem.ExplorerItemTypes = ADXOlExplorerItemTypes.olMailItem;
lsADXOlFormItem.AlwaysShowHeader = false;
lsADXOlFormItem.ExplorerAllowedDropRegions = ADXOlExplorerAllowedDropRegions.DockRight;
lsADXOlFormItem.IsMinimizedStateAllowed = false;
lsADXOlFormItem.IsDragDropAllowed = false;
lsADXOlFormItem.CloseButton = false;
lsADXOlFormItem.UseOfficeThemeForBackground = true;
lsADXOlFormItem.FormClassName = typeof(InvoADXOlForm).FullName;
this.FormsManager.Items.Add(lsADXOlFormItem);
]
I have checked by keeping break point at Initialize component. Constructor of ADXOlForm called twice.

Regards,
Lokesh
Posted 31 Mar, 2020 07:13:40 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Lokesh,

Is that code fragment located in the IntializeComponent() method which is called from the constructor of the add-in module? If so, it looks like the constructor of the module is called twice?


Andrei Smolin
Add-in Express Team Leader
Posted 31 Mar, 2020 07:25:18 Top
Lokesh Sharma




Posts: 18
Joined: 2020-03-15
Hi Andrei


I kept break point at constructor of form and it is hitting once it is initializing and another time when I switch folder. Due to initializing form twice, It is rendering same form twice with all controls.

Below code are inside Initialize component
[ private void InitializeComponent()
{

this.SuspendLayout();



//
// lsADXOlForm
//
this.ClientSize = new System.Drawing.Size(300, 300);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.ADXSplitterMove += new AddinExpress.OL.ADXOlForm.ADXSplitterMoveEventHandler(this.InvoADXOlForm_ADXSplitterMove);
this.Name = "lsTaskPane";
this.Text = "";
this.Size = new System.Drawing.Size(500, 1200);
this.ResumeLayout(false);
this.PerformLayout();
}]

Regards,
Lokesh
Posted 31 Mar, 2020 07:55:41 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Lokesh,

Your ADXOlFromsCollectionItem.Cached is set to the default value. This means the form should be recreated whenever you switch to a new folder. Find details in section Caching Forms; see the PDF file in the folder {Add-in Express}\Docs on your development PC.


Andrei Smolin
Add-in Express Team Leader
Posted 31 Mar, 2020 09:26:26 Top