어떤 사이클을 수행하고 WinForms의 다른 버튼을 누를 때까지 끊는 방법이 있습니까?다른 버튼을 누를 때까지 아무 사이클이나 C#
t.Start();
:
Thread t = new Thread (delegate() {
while(true) {
What you want to happen inside the loop in here;
Thread.Sleep(500); // this is useful for keeping the headroom of the CPU
}
});
하는 스레드 이런 식으로 시작 GUI를 차단하지 않고이 작업을 수행 할 수 있습니다
do
{
//Action
} while ("Button Stop is pressed");
이 작업을 수행하는 올바른 방법은 다음과 같습니다. [Async in 4.5 : Async API에서 진행 및 취소 활성화] (http://blogs.msdn.com/b/dotnet/archive/2012/06/06/async- in-4-5- 사용 가능 - 진행 및 취소 - async-apis.aspx). – Noseratio