Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k 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 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.7k users

...