๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ‘จ๐Ÿผ‍๐Ÿ’ป๊ฐœ๋ฐœ/C#

C# - setTimeout ๊ตฌํ˜„

by Janger 2022. 8. 28.
728x90
๋ฐ˜์‘ํ˜•
๋ฐฉ๋ฒ• 1.
Task.Delay(delay).ContinueWith((task) => { /* Code */ });

 

๋ฐฉ๋ฒ• 2.
public void setTimeout(Action TheAction, int Timeout)
{
    Thread t = new Thread(
        () =>
        {
            Thread.Sleep(Timeout);
            TheAction.Invoke();
        }
    );
    t.Start();
}

 

 

์ถœ์ฒ˜: 

https://stackoverflow.com/questions/4331149/winforms-equivalent-of-javascript-settimeout

 

Winforms equivalent of javascript setTimeout

Is there a simple solution/idea/strategy to create a setTimeout equivalent function in a WinForms app. I'm primarily a web developer but am not sure how I'd go about this in a WinForms App. Basical...

stackoverflow.com

 

728x90
๋ฐ˜์‘ํ˜•