Hirdetés
- Bemutatkozott a Poco X7 és X7 Pro
- Megbüntették, ezért feloszlatná az EU-t Elon Musk
- Elindult a One UI 8.5 béta program
- Xiaomi 15T Pro - a téma nincs lezárva
- Honor Magic6 Pro - kör közepén számok
- Megvan, mikor gyónja meg a Vivo az iPhone-másolást
- Samsung Galaxy A54 - türelemjáték
- Samsung Galaxy S25 - végre van kicsi!
- iPhone topik
- Örömhír: nem spórol Európán a OnePlus
Ú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!
- Bemutatkozott a Poco X7 és X7 Pro
- Futárcégek
- Battlefield 6
- eMAG vélemények - tapasztalatok
- AliExpress tapasztalatok
- Steam, GOG, Epic Store, Humble Store, Xbox PC Game Pass, Origin Access, uPlay+, Apple Arcade felhasználók barátságos izgulós topikja
- Spórolós topik
- Az ötlet jó, de milyen a kivitelezés? Teszten a Chieftec Kockája
- PROHARDVER! feedback: bugok, problémák, ötletek
- Starlink
- További aktív témák...
- LG 39GX90SA-W - 39" Ívelt Smart OLED/ WQHD 2K / 240Hz & 0.03ms / 1300 Nits / G-Sync & FreeSync
- Bomba ár! Dell Latitude 3520 - i5-1145G7 I 16GB I 256SSD I HDMI 15,6" FHD I Cam I W11 I Garancia!
- 184 - Lenovo Legion Pro 7 (16IAX10H) - Intel Core U9 275HX, RTX 5090
- GYÖNYÖRŰ iPhone 11 64GB Red -1 ÉV GARANCIA - Kártyafüggetlen, MS3121
- Dell Latitude E7470. Olcsó üzleti kategóriás laptop! Új akkumulátor!
Állásajánlatok
Cég: BroadBit Hungary Kft.
Város: Budakeszi
Cég: ATW Internet Kft.
Város: Budapest


