- SCUF Reflex (2025): Apró változtatás, hatalmas különbség?
- Mégis mi értelme az Xbox PC-nek, ha limitálja a hardverválasztékot?
- Sony MILC fényképezőgépcsalád
- OLED TV topic
- NVIDIA GeForce RTX 5080 / 5090 (GB203 / 202)
- AMD Ryzen 9 / 7 / 5 / 3 5***(X) "Zen 3" (AM4)
- Kormányok / autós szimulátorok topikja
- Intel Core i5 / i7 / i9 "Alder Lake-Raptor Lake/Refresh" (LGA1700)
- Teclast Tablet Topic
- Majdnem 20 évvel később befejezték a rajongók a PC-s Grand Theft Auto IV-et
Új hozzászólás Aktív témák
-
x007
tag
Jaaaa, WPF-ben nincsen gyári DoEvents, viszont van workaround:
private void button1_Click(object sender, RoutedEventArgs e)
{
button1.IsEnabled = false;
WpfApplication.DoEvents();
Thread.Sleep(3000);
button1.IsEnabled = true;
}
/// <summary>
/// Designates a Windows Presentation Foundation application model with added functionalities.
/// </summary>
public class WpfApplication : Application
{
private static DispatcherOperationCallback exitFrameCallback = new
DispatcherOperationCallback(ExitFrame);
/// <summary>
/// Processes all UI messages currently in the message queue.
/// </summary>
public static void DoEvents()
{
// Create new nested message pump.
DispatcherFrame nestedFrame = new DispatcherFrame();
// Dispatch a callback to the current message queue, when getting called,
// this callback will end the nested message loop.
// note that the priority of this callback should be lower than the that of UI event messages.
DispatcherOperation exitOperation = Dispatcher.CurrentDispatcher.BeginInvoke(
DispatcherPriority.Background, exitFrameCallback, nestedFrame);
// pump the nested message loop, the nested message loop will
// immediately process the messages left inside the message queue.
Dispatcher.PushFrame(nestedFrame);
// If the "exitFrame" callback doesn't get finished, Abort it.
if (exitOperation.Status != DispatcherOperationStatus.Completed)
{
exitOperation.Abort();
}
}
private static Object ExitFrame(Object state)
{
DispatcherFrame frame = state as DispatcherFrame;
// Exit the nested message loop.
frame.Continue = false;
return null;
}
}Megjegyzem, hogy ez továbbra se fogja teljes mértékig megoldani a problémát, mert az ablak ugyanúgy meg fog fagyni a DB kapcsolat tesztelésekor. (WinForms esetén is így lenne) Szóval mindenképpen javaslom a BackGroundWorker használatát.
Új hozzászólás Aktív témák
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- iPhone topik
- Gumi és felni topik
- SCUF Reflex (2025): Apró változtatás, hatalmas különbség?
- Audi, Cupra, Seat, Skoda, Volkswagen topik
- Mégis mi értelme az Xbox PC-nek, ha limitálja a hardverválasztékot?
- exHWSW - Értünk mindenhez IS
- Lakáshitel, lakásvásárlás
- Apple Watch Sport - ez is csak egy okosóra
- Sony MILC fényképezőgépcsalád
- Hardcore café
- További aktív témák...
- PlayStation DualSense Edge kontroller AKCIÓ!!! // Számla + Garancia //
- MacBook felváráslás!! MacBook, MacBook Air, MacBook Pro
- Telefon felvásárlás!! iPhone 11/iPhone 11 Pro/iPhone 11 Pro Max
- HIBÁTLAN iPhone 14 Pro 256GB Deep Purple -1 ÉV GARANCIA - Kártyafüggetlen, MS3516, 94% Akkumulátor
- MSI Sword 16 - Core i7 / RTX 4050 / per key RGB / magyar garancia
Állásajánlatok
Cég: CAMERA-PRO Hungary Kft.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest