I have a Windows service in which I need to stop worker threads from my main thread. I am trying to use events to do this but I am stumped on why it is not working. Each class that runs a worker thread creates a stop event and a response event. When I need to stop the worker thread I call into the threads class and set the event. However, instead of the worker thread detecting that the event has been set and stopping gracefully, it just disappears. Why?
What is the best method for stopping a worker thread from the main thread?
I've been working on a windows mobile application that consists of a series of dynamically generated user forms and I was wondering if anyone knows how (following activation of the On-Screen Keyboard) I would get the currently selected form item to move up so it is above the OSK. Currently when the OSK is activated it obscures the active items and worse still completely obscures items at the bottom of the form. Its gotta be possible but I'm really stuck on how I would actually do it.
I'm pretty new to C# (<6mo) and especially to programming for mobile devices. Any help would be greatly appreciated. Hopefully the solution isn't staring me in the face
You may try setting the Top property of the selected control to a value above the keyboard showing.
For example, in the code below, I am changing the top property of the checkbox which gets hidden when the input panel is enabled:
What have you tried so far? We can't help without knowing what the exact problem is.
If you do a little research but don't understand, then ask about the part you don't understand. If you've written code that doesn't work right, and you don't know why (or you know why, but don't know how to fix it) then ask us for help.
There's not much good in making a statement of what you want to do, and then expecting to be given the code.
what happens behind the scene of statement, "yield return result"?
I think what happens is a object instance which implements IEnumerable (collection pattern) interface is created (but what is the type of the instance? some C# internal type?), and each time "yield return result" is called, a new element is inserted into the internal array of the instance. Any more reference documents?
I got interested in this and investigated, and wrote a massive reply about what was happening in the IL, all commented and everything, then it didn't post properly and I lost it.
Basically, it compiles it to a private that inherits from IEnumerator inside your class. It moves your code into the MoveNext routine of the private class, and splits it up with a case statement so each time MoveNext is called, it does the next bit of your routine up to the next yield return statement, and then sets the Current property of the private to be your yield return value. This means when you stick your class in a foreach loop, the foreach loop calls GetEnumerator, which returns the private class, and then calls MoveNext and keeps looking at the Current property.
Just write a simple class that implements IEnumerable, and a GetEnumerator() method, compile it, and take a look with reflector, you'll see what I'm babbling on about.
Yes, that's right. That's what I was talking about. The variables named with < and > signs in them. They're named like that to ensure no clashes can occur with your variables because those characters aren't allowed to be used in variable names in c#
My current confusion is, I think the yield return grammar is of too flexibility, any ideas in what situation should we use it (in the implementation samples, it is used in for loop, while loop and foreach loop, too flexibility to grasp)?
What means "Older objects needing finalization might have to wait for dozens if not hundreds of gen0 collections before their space is reclaimed."? I am especially confused about what means "wait for dozens" and "if not...", seems there are some dependencies between gen2 collection and gen0 collection?
thanks in advance,
Last Visit: 31-Dec-99 18:00 Last Update: 3-Oct-23 5:11