Why when I do in the Console.Beep(1000, 35000); program Console.Beep(1000, 35000); then it hangs and so freezes that the message “Program does not respond” does not even appear?
UPD :
Why do I still have it freezes despite the fact that I brought beep into an asynchronous stream?
static async Task beeping() { Console.Beep(1000, 1000); } private void refresh(object sender, EventArgs e) { label1.Content = "Последнее обновление было "+ lastref++.ToString() + " сек. назад"; if (beep == true) { var task = beeping(); task.Wait(); } } UPD :
Tried differently, also does not help
static void beeping() { Console.Beep(1000, 1000); } private void refresh(object sender, EventArgs e) { label1.Content = "Последнее обновление было "+ lastref++.ToString() + " сек. назад"; if (beep == true) { SomeDelegate sd = beeping; IAsyncResult asyncRes = sd.BeginInvoke(null,null); sd.EndInvoke(asyncRes); } }