- Amazon Kindle
- Milyen billentyűzetet vegyek?
- Borsos árú alumíniumfelni? Nem, egy asztali PC!
- VR topik (Oculus Rift, stb.)
- AMD Navi Radeon™ RX 9xxx sorozat
- AMD K6-III, és minden ami RETRO - Oldschool tuning
- ThinkPad (NEM IdeaPad)
- Milyen belső merevlemezt vegyek?
- Kezdő fotósok digitális fényképei
- HiFi műszaki szemmel - sztereó hangrendszerek
Ú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!
- Borderlands 4
- Battlefield 6
- Amazon Kindle
- Milyen billentyűzetet vegyek?
- Borsos árú alumíniumfelni? Nem, egy asztali PC!
- Fortnite - Battle Royale & Save the World (PC, XO, PS4, Switch, Mobil)
- Audi, Cupra, Seat, Skoda, Volkswagen topik
- sziku69: Fűzzük össze a szavakat :)
- Windows XP
- „Új mérce az Android világában” – Kezünkben a Vivo X300 és X300 Pro
- További aktív témák...
- Bomba Ár! Lenovo IdeaPad Flex 5 Ryzen 3 5300U I 4GB I 128SSD I 14" FHD Touch I W11 I Cam I Garancia!
- Bomba ár! HP ProBook X360 435 G7 - Ryzen 3/5 I 8GB I 256SSD I 13,3" FHD Touch I W11 I Cam I Gari!
- Bomba ár! Lenovo ThinkPad X13 G1 - AMD Ryzen 5 PRO I 8GB I 256SSD I 13,3" FHD I Cam I W11 I Gari!
- Bomba Ár! Lenovo ThinkPad E14 G2 AMD - Ryzen 5 I 8GB I 256SSD I 14" FHD I HDMI I W11 I Gari
- Bomba ár! Lenovo ThinkPad T14s G1 - i7-10G I 16GB I 512GB SSD I 14" FHD Touch I Cam I W11 I Gari!
- LG 38WN95C - 38" Ívelt NANO IPS - 3840x1600 - 144hz 1ms - Nvidia G-Sync - AMD FreeSync - ThunderBolt
- BESZÁMÍTÁS! ASUS ROG STRIX Z390-H GAMING alaplap garanciával hibátlan működéssel
- Bomba Ár! Lenovo IdeaPad Flex 5 Ryzen 3 5300U I 4GB I 128SSD I 14" FHD Touch I W11 I Cam I Garancia!
- Bomba ár! Dell Latitude 5500 - i5-8GEN I 16GB I 256SSD I HDMI I 15,6" FHD I Cam I W11 I Garancia!
- Honor X6a 128GB, Kártyafüggetlen, 1 Év Garanciával
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest