c# run process without freezing my App's GUI

前端 未结 3 2119
清歌不尽
清歌不尽 2020-12-20 06:03

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

3条回答
  •  暖寄归人
    2020-12-20 06:54

    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

提交回复
热议问题