Click here to Skip to main content
15,171,576 members
Home / Discussions / C#
   

C#

 
GeneralRe: Get one type of elements from dictionary Pin
SledgeHammer0127-Jun-11 20:44
MemberSledgeHammer0127-Jun-11 20:44 
GeneralRe: Get one type of elements from dictionary Pin
Mycroft Holmes27-Jun-11 20:49
professionalMycroft Holmes27-Jun-11 20:49 
QuestionNavigating between forms Pin
Berlus26-Jun-11 2:19
MemberBerlus26-Jun-11 2:19 
AnswerRe: Navigating between forms Pin
Mycroft Holmes26-Jun-11 2:59
professionalMycroft Holmes26-Jun-11 2:59 
AnswerRe: Navigating between forms Pin
Not Active27-Jun-11 3:29
mentorNot Active27-Jun-11 3:29 
QuestionCustom control sometimes doesn't paint/refresh the button on it Pin
teknolog12326-Jun-11 0:13
Memberteknolog12326-Jun-11 0:13 
AnswerRe: Custom control sometimes doesn't paint/refresh the button on it Pin
Dave Kreskowiak27-Jun-11 10:22
mveDave Kreskowiak27-Jun-11 10:22 
QuestionStarting intrupped thread again.. Pin
shivamkalra25-Jun-11 20:06
Membershivamkalra25-Jun-11 20:06 
Hi,

I need to design a program should be able to update certain textbox for each event inside the GUI and after every 10 seconds of most recent event, text tox should be back to original value..Let say
<br />
Event one occurs --> text box updated --> after 10 seconds --> text box back to normal


This is the case in perfect world, but it might be possible that someone create another GUI event during this period of 10 seconds..

Event one occurs --> text box updated --> after 8 seconds --> event two occurs --> GUI updated --> after 2 seconds the other thread (10 seconds completed for first event), text box back to normal.

So in this case, for second event, the textbox get back to original value in just 2 seconds. I know I could use thread intrupt to cancel the other thread. But my question is, it the best way of doing it?? And what is there any other way to starting intrupped thread again, without making a new thread? Will thread intrupt make sure everything will go perfect?? Would you suggest some more efficient way? I may be misunderstanding about threading here, please forgive that. Any suggestions, links or comments will be appreciated.

PS
So far my code is like this..

Thread t = new Thread(keep_run);

public void update()
{
    t.Interrupt();
    if (MessageLbl.InvokeRequired)
    {
        MessageLbl.Invoke(new setText(() => MessageLbl.Text = "User settings have been updated."));
    }
    else
    {
        MessageLbl.Text = "User settings have been updated.";
    }

    t = new Thread(keep_run);
    t.Start();
}

private void keep_run()
{
    try
    {
        Thread.Sleep(10000);
        MessageLbl.Invoke(new setText(() => MessageLbl.Text = "Welcome to MAT Downloader"));
    }
    catch { MessageBox.Show("Interrupted"); }
}
}


If you find any other problems with the code then do mention them.

Thanks
Regards,
Shivam Kalra Smile | :)
AnswerRe: Starting intrupped thread again.. Pin
MicroVirus26-Jun-11 1:44
MemberMicroVirus26-Jun-11 1:44 
QuestionNamedPipeClientStream.Connect(int) doesn't throw Exception if Form is closed. [fixed, workaround] Pin
Xmen Real 25-Jun-11 18:59
professional Xmen Real 25-Jun-11 18:59 
QuestionKnow when form loses focus? Pin
Matt U.25-Jun-11 14:30
MemberMatt U.25-Jun-11 14:30 
AnswerRe: Know when form loses focus? Pin
Dr.Walt Fair, PE25-Jun-11 17:49
professionalDr.Walt Fair, PE25-Jun-11 17:49 
GeneralRe: Know when form loses focus? Pin
Matt U.26-Jun-11 3:47
MemberMatt U.26-Jun-11 3:47 
QuestionPopulate Listview using LINQ Pin
klaydze24-Jun-11 16:22
Memberklaydze24-Jun-11 16:22 
QuestionRe: Populate Listview using LINQ Pin
Mario Majčica24-Jun-11 22:20
professionalMario Majčica24-Jun-11 22:20 
AnswerRe: Populate Listview using LINQ Pin
#realJSOP25-Jun-11 1:30
mva#realJSOP25-Jun-11 1:30 
GeneralRe: Populate Listview using LINQ Pin
Mycroft Holmes25-Jun-11 3:39
professionalMycroft Holmes25-Jun-11 3:39 
GeneralRe: Populate Listview using LINQ Pin
Dan Mos25-Jun-11 4:26
MemberDan Mos25-Jun-11 4:26 
GeneralRe: Populate Listview using LINQ Pin
Not Active27-Jun-11 3:27
mentorNot Active27-Jun-11 3:27 
AnswerRe: Populate Listview using LINQ Pin
klaydze25-Jun-11 4:25
Memberklaydze25-Jun-11 4:25 
QuestionTask queues to execute a task one by one in file downloader program. [modified] Pin
shivamkalra24-Jun-11 13:37
Membershivamkalra24-Jun-11 13:37 
AnswerRe: Task queues to execute a task one by one in file downloader program. Pin
Richard MacCutchan25-Jun-11 0:01
mveRichard MacCutchan25-Jun-11 0:01 
QuestionNot Lost focus of form. Pin
Anubhava Dimri24-Jun-11 0:46
MemberAnubhava Dimri24-Jun-11 0:46 
AnswerRe: Not Lost focus of form. Pin
Mario Majčica24-Jun-11 5:12
professionalMario Majčica24-Jun-11 5:12 
SuggestionRe: Not Lost focus of form. Pin
MicroVirus24-Jun-11 7:08
MemberMicroVirus24-Jun-11 7:08 

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.