473,698 Members | 2,152 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ISynchronizeInv oke and UI Culture problem

Hi NG !
I set the CurrentCulture and the CurrentUICultur e at the start of my
app using this code:

string sUICulture =
System.Configur ation.Configura tionSettings.Ap pSettings["UICulture"];
if (sUICulture != null) {
CultureInfo cultInfo = new CultureInfo(sUI Culture);
Thread.CurrentT hread.CurrentUI Culture = cultInfo;
Thread.CurrentT hread.CurrentCu lture = cultInfo;
}

That fine, all my UI text appears according the settings in the
app.config. But in one case, I handle an event of a related system. (At
the moment no synchronisation is done). This code runs with the culture
settings of the System. (That's OK, because i did not synchronize). Now
I would like to check if Invoke is required (InvokeRequired ). But this
does not work. The value is set to true, but if I debug the project,
the code within the if clause would not be executed. Why ?
In this state of execution it is possible to retrieve the
CurrentUICultur e for the thread, but after an aditional call of a
function, it is neither possible the get the UICulture from the thread,
nor from the System. Why? What could go wrong ?

Thanks
Marcel

Sep 15 '06 #1
1 2396
I'm sorry my fault I just have the following problem:
I set the CurrentCulture and the CurrentUICultur e at the start of my
app using this code:

string sUICulture =
System.Configur ation.Configura tionSettings.Ap pSettings["UICulture"];
if (sUICulture != null) {
CultureInfo cultInfo = new CultureInfo(sUI Culture);
Thread.CurrentT hread.CurrentUI Culture = cultInfo;
Thread.CurrentT hread.CurrentCu lture = cultInfo;
}

That fine, all my UI text appears according the settings in the
app.config. But in one case, I handle an event of a related system. (At
the moment no synchronisation is done). This code runs with the culture
settings of the System. (That's OK, because i did not synchronize).
In this state of execution it is possible to retrieve the
CurrentUICultur e for the thread, but after an additional call of a
function, it is neither possible the get the UICulture from the thread,
nor from the System. Why? What could go wrong ?


schaf schrieb:
Hi NG !
I set the CurrentCulture and the CurrentUICultur e at the start of my
app using this code:

string sUICulture =
System.Configur ation.Configura tionSettings.Ap pSettings["UICulture"];
if (sUICulture != null) {
CultureInfo cultInfo = new CultureInfo(sUI Culture);
Thread.CurrentT hread.CurrentUI Culture = cultInfo;
Thread.CurrentT hread.CurrentCu lture = cultInfo;
}

That fine, all my UI text appears according the settings in the
app.config. But in one case, I handle an event of a related system. (At
the moment no synchronisation is done). This code runs with the culture
settings of the System. (That's OK, because i did not synchronize). Now
I would like to check if Invoke is required (InvokeRequired ). But this
does not work. The value is set to true, but if I debug the project,
the code within the if clause would not be executed. Why ?
In this state of execution it is possible to retrieve the
CurrentUICultur e for the thread, but after an aditional call of a
function, it is neither possible the get the UICulture from the thread,
nor from the System. Why? What could go wrong ?

Thanks
Marcel
Sep 15 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2249
by: GM | last post by:
Hi, My application has a need to cache a number of shared reference lists containing basic business objects. In order to improve performance these lists are fetched and updated in the background. When a UI is required to display one of these reference lists it requests it by name from the cache. If the list already exists in the cache it is returned to the caller otherwise a brand new empty one is created and returned. This new empty...
0
1418
by: Jedrzej Miadowicz | last post by:
I have a problem when using ISynchronizeInvoke.BeginInvoke with polymorphic parameters. It seems that if I try to call BeginInvoke and in the array of parameters place an object that's derived from a base class my method expects as a parameter, the method gets only an object of the type of the base class, rather than my full object. I know this sounds convoluted, so here's an example. My program consists of an engine and a WindowsForms...
2
1963
by: Tom Dacon | last post by:
I'm raising an event in a component, using ISynchronizeInvoke.Invoke, and my event args object contains a string as one of its members. If the string is longer than 63 bytes, the Invoke call pulls an unhandled exception in System.Windows.Forms.dll, to the effect that the string length must be less than 64. If I trim the string to 31 characters (62 bytes) everything's fine and the event goes as intended. But if the string length is 32 or...
1
5008
by: Tim Murray | last post by:
Hi, I am creating a multithreaded server application in Managed C++. Each client that connects to the server will be running on their own thread to process their input. They all need to share one instance of a class running on the main thread. From my understanding, if multiple threads invoke a function in this object(on the main thread) using a delegate, there could be problems. I was trying to figure out how to invoke the functions...
0
2497
by: Wavemaker | last post by:
One of the things I've struggled with from time to time is handling events raised on different threads. For example, an object could be listening to events from one or more objects running in different threads besides itself. There is a concern for thread safety. There are various ways of dealing with this. One way is to make the class thread safe by putting in locks. But another way is to stream the events from the various threads into a...
2
599
by: JezB | last post by:
How do I programatically set the culture at session level ?
1
3084
by: Thai Mai Shu | last post by:
What is wrong with my call below. If I change the delegate and the CallBackComplete function to not take in parameters then the .Invoke call works fine. As soon as I put the parameters back I get "Parameter count mismatch." error. Am I supposed to implement ISynchronizeInvoke in order to call .Invoke? If so, why does it work when the method i am trying to invoke has no parameters. Private Delegate Sub CallbackCompleteDelegate(ByVal...
4
4022
by: jherl | last post by:
I am getting an "Object reference not set to an instance of an object" when I try to execute the Invoke method. I have it set up as follows: --- Private _syncObject As System.ComponentModel.ISynchronizeInvoke .. .. .. Dim args(0) As Object Dim d As New RaiseReceiveEvent(AddressOf OnReceive) ..
6
6929
by: Mike9900 | last post by:
Hello, I want to view the calendar in another culture, for example let it show in Arabic. I use this code in the Main, but the calendar is still in the same culture: CultureInfo sa = new CultureInfo("ar-SA", false); sa.DateTimeFormat.Calendar = new System.Globalization.HijriCalendar(); // Sets the culture to Arabic (Saudi Arabia) Thread.CurrentThread.CurrentCulture = sa;
0
8676
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8608
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9164
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8870
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3051
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.