Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

multithreading - c# run process without freezing my App's GUI

I want to start a process (calling another program), currently the external program takes time (it is normal)!

but it freezes my GUI I saw allot of examples and I'm learning, it is hard to figure it out, trying to read and learn threading, but it is not that easy (at least for me) and good simple tutorial or code sample?

cheers

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Here is a link showing how to use an asynchronous method. http://www.codeproject.com/KB/cs/AsyncMethodInvocation.aspx

You can use the asynchronous method to start the process, and it won't freeze the gui while it starts up.

void Your_Method()
{
   //Start process here
}


MethodInvoker myProcessStarter= new MethodInvoker(Your_Method);

myProcessStarter.BeginInvoke(null, null);

MethodInvoker Description


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...