Wrong CurrentUICulture with Teamviewer installed

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

Wrong CurrentUICulture with Teamviewer installed
 
Christopher Thiede




Posts: 38
Joined: 2016-07-05
Hello Andrei,

it works but I fear that I can get trouble if a customer has another Add-In that changes the CurrentUICulture e.g. between my OnHostApplicationInitialized and the calls of ApplyResources in InitializeComponents.
Posted 28 Dec, 2016 05:45:12 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello Christopher,

In OnHostApplicationInitialized, you can store a reference to the correct CurrentUICulture and restore the reference before the InitializeComponents method is called.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 28 Dec, 2016 08:31:54 Top
Christopher Thiede




Posts: 38
Joined: 2016-07-05
But why isn't it possible to get Culture of the Office App and use it for overload of ApplyResources?
If I use

OutlookApp.LanguageSettings.LanguageID[MsoAppLanguageID.msoLanguageIDUI]

in my InitializeComponent() without OnHostApplicationInitialized() I can't register my Add-In.
Posted 28 Dec, 2016 08:41:35 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello Christopher,

In the code of the OutlookApp property, you see the use of the HostApplication property of the add-in module:

public Outlook._Application OutlookApp
{
    get
    {
        return (HostApplication as Outlook._Application);
    }
}


If you call InitializeComponent from the constructor of the add-in module, the HostApplication property isn't set by this moment and this is why your code breaks.

Note that in the code published in that blog, Dmitry calls InitializeComponent from the OnHostApplicationInitialized() method (if Outlook loads the add-in). The module is already created by the time this calls is made.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Dec, 2016 05:52:34 Top
Christopher Thiede




Posts: 38
Joined: 2016-07-05
Hi Andrei,

thank you for your explanation and your patience. Now I get the point why my suggested code can't work.

Best Regard from Germany
Christopher
Posted 03 Jan, 2017 04:46:20 Top
Dmitry Kostochko


Add-in Express team


Posts: 2731
Joined: 2004-04-05
Hi Christopher,

You are welcome!
Posted 03 Jan, 2017 09:07:28 Top