Click here to Skip to main content
15,909,539 members
Home / Discussions / C#
   

C#

 
GeneralRe: yield Pin
Luc Pattyn11-Dec-10 1:00
sitebuilderLuc Pattyn11-Dec-10 1:00 
GeneralRe: yield [modified] Pin
igalep13211-Dec-10 4:53
igalep13211-Dec-10 4:53 
AnswerRe: yield Pin
Luc Pattyn11-Dec-10 14:03
sitebuilderLuc Pattyn11-Dec-10 14:03 
GeneralRe: events between two threads Pin
Not Active5-Dec-10 11:38
mentorNot Active5-Dec-10 11:38 
GeneralRe: events between two threads [modified] Pin
igalep1326-Dec-10 10:40
igalep1326-Dec-10 10:40 
GeneralRe: events between two threads Pin
Not Active6-Dec-10 10:58
mentorNot Active6-Dec-10 10:58 
GeneralRe: events between two threads Pin
igalep1326-Dec-10 11:14
igalep1326-Dec-10 11:14 
AnswerRe: events between two threads Pin
Luc Pattyn5-Dec-10 12:27
sitebuilderLuc Pattyn5-Dec-10 12:27 
if you want real synchronization between two threads, there are several tools available for that. Have a look at ManualResetEvent and AutoResetEvent classes. The pseudo-code could be:

// background thread would call a method like this one, each time it needs the user's input:

public string WaitForUser(string message) {
    // do whatever is needed to get the message displayed to the user
    ...
    // wait for user interaction
    myAutoResetEvent.WaitOne();
    // get user input 
    return someGlobalVariable;
}

// UI could have a TextBox+Button, and the button click handler would do:
    public void myButton_Click(object sender, EventArgs e) {
        // get user input
        string s=myTextBox.Text;
        someGlobalVariable=s;
        // tell background to continue 
        myAutoResetEvent.Signal();
    }


Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.


AnswerRe: events between two threads Pin
Pete O'Hanlon5-Dec-10 9:31
mvePete O'Hanlon5-Dec-10 9:31 
GeneralRe: events between two threads Pin
igalep1325-Dec-10 9:37
igalep1325-Dec-10 9:37 
GeneralRe: events between two threads Pin
Not Active5-Dec-10 9:55
mentorNot Active5-Dec-10 9:55 
GeneralRe: events between two threads Pin
Pete O'Hanlon5-Dec-10 9:55
mvePete O'Hanlon5-Dec-10 9:55 
AnswerRe: events between two threads Pin
PIEBALDconsult5-Dec-10 13:48
mvePIEBALDconsult5-Dec-10 13:48 
Questionhow make textbox or masked textbox take month and year only such as "mm/yyyy" Pin
Nabawoka5-Dec-10 5:43
Nabawoka5-Dec-10 5:43 
AnswerRe: how make textbox or masked textbox take month and year only such as "mm/yyyy" Pin
OriginalGriff5-Dec-10 6:11
mveOriginalGriff5-Dec-10 6:11 
AnswerRe: how make textbox or masked textbox take month and year only such as "mm/yyyy" Pin
Manfred Rudolf Bihy5-Dec-10 6:14
professionalManfred Rudolf Bihy5-Dec-10 6:14 
AnswerRe: how make textbox or masked textbox take month and year only such as "mm/yyyy" Pin
Nabawoka5-Dec-10 11:06
Nabawoka5-Dec-10 11:06 
AnswerRe: how make textbox or masked textbox take month and year only such as "mm/yyyy" Pin
Eddy Vluggen5-Dec-10 12:01
professionalEddy Vluggen5-Dec-10 12:01 
QuestionWeb Browser Tab Control problem Pin
nawoc5-Dec-10 5:06
nawoc5-Dec-10 5:06 
AnswerRe: Web Browser Tab Control problem Pin
Luc Pattyn5-Dec-10 7:46
sitebuilderLuc Pattyn5-Dec-10 7:46 
GeneralRe: Web Browser Tab Control problem Pin
nawoc5-Dec-10 9:42
nawoc5-Dec-10 9:42 
GeneralRe: Web Browser Tab Control problem Pin
Luc Pattyn5-Dec-10 9:44
sitebuilderLuc Pattyn5-Dec-10 9:44 
QuestionShould I be using inhertance for this? Pin
Jacob D Dixon4-Dec-10 15:26
Jacob D Dixon4-Dec-10 15:26 
AnswerRe: Should I be using inhertance for this? Pin
PIEBALDconsult4-Dec-10 16:30
mvePIEBALDconsult4-Dec-10 16:30 
GeneralRe: Should I be using inhertance for this? [modified] Pin
Jacob D Dixon4-Dec-10 17:14
Jacob D Dixon4-Dec-10 17:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.