Il seguente è un metodo generale DoEvents tipo
using System;
using System.Windows.Threading;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Permissions;
namespace Utilites
{
/// <summary>
/// Emulates the VB6 DoEvents to refresh a window during long running events
/// </summary>
public class ScreenEvents
{
[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public static void DoEvents()
{
DispatcherFrame frame = new DispatcherFrame();
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background,
new DispatcherOperationCallback(ExitFrame), frame);
Dispatcher.PushFrame(frame);
}
public static object ExitFrame(object f)
{
((DispatcherFrame)f).Continue = false;
return null;
}
}
}
Non ha bisogno di sapere circa l'applicazione.
fonte
2012-09-27 17:58:50
Penso che stiate pensando a Doevents. Il rendimento è un metodo .NET utilizzato nella gestione delle enumerazioni. E l'equivalente in .NET è Application.DoEvents() (indipendentemente dalla lingua utilizzata) – Zippit
'Application.DoEvents() == DoEvents'? – Marlon
@Marlon: Capisco. In realtà ricordo di aver fatto questa domanda ogni pochi anni. Non ricordo quando l'ho chiesto per ultimo. Potresti avere ragione e quella potrebbe essere la risposta, ma la mia memoria non mi soddisfa. Sto anche pensando di aver trovato un sostituto in uno dei metodi della classe System.Diagnostics.Process ma non riesco a ricordare con certezza. –