Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# wait without GUI blocks

public void wait(int milliseconds)
{
    var timer1 = new System.Windows.Forms.Timer();
    if (milliseconds == 0 || milliseconds < 0) return;

    // Console.WriteLine("start wait timer");
    timer1.Interval = milliseconds;
    timer1.Enabled  = true;
    timer1.Start();

    timer1.Tick += (s, e) =>
    {
        timer1.Enabled = false;
        timer1.Stop();
        // Console.WriteLine("stop wait timer");
    };

    while (timer1.Enabled)
    {
        Application.DoEvents();
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# Isolation Levels 
Csharp :: Difference between Math.Floor() and Math.Truncate() 
Csharp :: using autofac with automapper .net 6 with dependency injection 
Csharp :: how can datetimepicker accept hour as well 
Csharp :: eleventy set default layout 
Csharp :: FileSystemEventHandler raised twice 
Csharp :: 2d look at unity 
Csharp :: unity remove component 
Csharp :: c# project 
Csharp :: using c# 
Csharp :: c# only only 2 digits after decimal number double 
Csharp :: c# loop array backwards 
Csharp :: ocr library for c# 
Csharp :: transform.rotate unity 2d 
Csharp :: unity 2d platformer movement script rigidbody 
Csharp :: how to make a enemy in unity 
Csharp :: how to scale text from center in unity 
Csharp :: use different database with entitymanagerfactory 
Csharp :: black lives matter update arsenal 
Html :: font awesome icon for email 
Html :: how open link in new tab 
Html :: html link to call phone number 
Html :: how to run vscode as root 
Html :: bootstrap circle button 
Html :: how to make links open in a new window 
Html :: bootstrap 4 image fit to div 
Html :: how to center link in html 
Html :: back button ionic 
Html :: html file 
Html :: meta refresh url 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =