Dispatcher.Invoke Methode
Definition
Führt den angegebenen Delegaten synchron auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate synchronously on the thread the Dispatcher is associated with.
Überlädt
Invoke(DispatcherPriority, TimeSpan, Delegate, Object, Object[]) |
Führt den angegebenen Delegaten mit der angegebenen Priorität und den angegebenen Argumenten synchron auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate at the specified priority with the specified arguments synchronously on the thread the Dispatcher is associated with. |
Invoke(DispatcherPriority, TimeSpan, Delegate, Object) |
Führt den angegebenen Delegaten mit der angegebenen Priorität und dem angegebenen Argument synchron auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate at the specified priority with the specified argument synchronously on the thread the Dispatcher is associated with. |
Invoke(DispatcherPriority, Delegate, Object, Object[]) |
Führt den angegebenen Delegaten mit der angegebenen Priorität und den angegebenen Argumenten synchron auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate at the specified priority with the specified arguments synchronously on the thread the Dispatcher is associated with. |
Invoke(Action, DispatcherPriority, CancellationToken, TimeSpan) |
Führt die angegebene Action synchron mit der angegebenen Priorität auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Action synchronously at the specified priority on the thread the Dispatcher is associated with. |
Invoke(DispatcherPriority, TimeSpan, Delegate) |
Führt den angegebenen Delegaten synchron mit der angegebenen Priorität und dem angegebenen Timeoutwert auf dem Thread aus, in dem der Dispatcher erstellt wurde.Executes the specified delegate synchronously at the specified priority and with the specified time-out value on the thread the Dispatcher was created. |
Invoke(DispatcherPriority, Delegate, Object) |
Führt den angegebenen Delegaten mit der angegebenen Priorität und dem angegebenen Argument synchron auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate at the specified priority with the specified argument synchronously on the thread the Dispatcher is associated with. |
Invoke(Delegate, TimeSpan, DispatcherPriority, Object[]) |
Führt den angegebenen Delegaten in der angegebenen Zeitspanne mit der angegebenen Priorität und den angegebenen Argumenten synchron für den Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate within the designated time span at the specified priority with the specified arguments synchronously on the thread the Dispatcher is associated with. |
Invoke(Delegate, TimeSpan, Object[]) |
Führt den angegebenen Delegaten in der angegebenen Zeitspanne mit der angegebenen Priorität und den angegebenen Argumenten synchron für den Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate within the designated time span at the specified priority with the specified arguments synchronously on the thread the Dispatcher is associated with. |
Invoke(Action, DispatcherPriority, CancellationToken) |
Führt die angegebene Action synchron mit der angegebenen Priorität auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Action synchronously at the specified priority on the thread the Dispatcher is associated with. |
Invoke(DispatcherPriority, Delegate) |
Führt den angegebenen Delegaten synchron mit der angegebenen Priorität auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate synchronously at the specified priority on the thread on which the Dispatcher is associated with. |
Invoke(Delegate, Object[]) |
Führt den angegebenen Delegaten synchron mit den angegebenen Argumenten für den Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate with the specified arguments synchronously on the thread the Dispatcher is associated with. |
Invoke(Action, DispatcherPriority) |
Führt die angegebene Action synchron mit der angegebenen Priorität auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Action synchronously at the specified priority on the thread the Dispatcher is associated with. |
Invoke(Action) |
Führt die angegebene Action synchron auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Action synchronously on the thread the Dispatcher is associated with. |
Invoke(Delegate, DispatcherPriority, Object[]) |
Führt den angegebenen Delegaten mit der angegebenen Priorität und den angegebenen Argumenten synchron auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate at the specified priority with the specified arguments synchronously on the thread the Dispatcher is associated with. |
Invoke<TResult>(Func<TResult>) |
Führt die angegebene Func<TResult> synchron auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Func<TResult> synchronously on the thread the Dispatcher is associated with. |
Invoke<TResult>(Func<TResult>, DispatcherPriority) |
Führt die angegebene Func<TResult> synchron mit der angegebenen Priorität auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Func<TResult> synchronously at the specified priority on the thread the Dispatcher is associated with. |
Invoke<TResult>(Func<TResult>, DispatcherPriority, CancellationToken) |
Führt die angegebene Func<TResult> synchron mit der angegebenen Priorität auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Func<TResult> synchronously at the specified priority on the thread the Dispatcher is associated with. |
Invoke<TResult>(Func<TResult>, DispatcherPriority, CancellationToken, TimeSpan) |
Führt die angegebene Func<TResult> synchron mit der angegebenen Priorität auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Func<TResult> synchronously at the specified priority on the thread the Dispatcher is associated with. |
Beispiele
Im folgenden Beispiel wird ein Delegat unter Dispatcher Verwendung Normal Invokevon auf einen platziert.The following example places a delegate onto a Dispatcher at Normal using Invoke.
// Places the delegate onto the UI Thread's Dispatcher
private void timer_Elapsed(object sender, ElapsedEventArgs e)
{
// Place delegate on the Dispatcher.
this.Dispatcher.Invoke(DispatcherPriority.Normal,
new TimerDispatcherDelegate(TimerWorkItem));
}
' Places the delegate onto the UI Thread's Dispatcher
Private Sub timer_Elapsed(ByVal sender As Object, ByVal e As ElapsedEventArgs)
' Place delegate on the Dispatcher.
Me.Dispatcher.Invoke(DispatcherPriority.Normal, New TimerDispatcherDelegate(AddressOf TimerWorkItem))
End Sub
Hinweise
In WPFWPFkann nur der Thread, der einen DispatcherObject erstellt hat, auf dieses Objekt zugreifen.In WPFWPF, only the thread that created a DispatcherObject may access that object. Beispielsweise kann ein Hintergrund Thread, der aus dem Hauptbenutzer Oberflächen-Thread ausgelöst wird, den Inhalt eines Button nicht aktualisieren, der im UI-Thread erstellt wurde.For example, a background thread that is spun off from the main UI thread cannot update the contents of a Button that was created on the UI thread. Damit der Hintergrund Thread auf die Content-Eigenschaft von Buttonzugreifen kann, muss der Hintergrund Thread die Arbeit an die Dispatcher mit dem UI-Thread zugeordnete delegieren.In order for the background thread to access the Content property of the Button, the background thread must delegate the work to the Dispatcher associated with the UI thread. Dies wird mithilfe Invoke von oder BeginInvokeerreicht.This is accomplished by using either Invoke or BeginInvoke. Invokeist synchron und BeginInvoke ist asynchron.Invoke is synchronous and BeginInvoke is asynchronous. Der-Vorgang wird der-Ereignis Warteschlange Dispatcher von am angegebenen DispatcherPriorityhinzugefügt.The operation is added to the event queue of the Dispatcher at the specified DispatcherPriority.
Invokeist ein synchroner Vorgang. Daher wird die Steuerung erst wieder an das aufrufende Objekt zurückgegeben, nachdem der Rückruf zurückgegeben wurde.Invoke is a synchronous operation; therefore, control will not return to the calling object until after the callback returns.
Invoke(DispatcherPriority, TimeSpan, Delegate, Object, Object[])
Führt den angegebenen Delegaten mit der angegebenen Priorität und den angegebenen Argumenten synchron auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate at the specified priority with the specified arguments synchronously on the thread the Dispatcher is associated with.
public:
System::Object ^ Invoke(System::Windows::Threading::DispatcherPriority priority, TimeSpan timeout, Delegate ^ method, System::Object ^ arg, ... cli::array <System::Object ^> ^ args);
[System.ComponentModel.Browsable(false)]
public object Invoke (System.Windows.Threading.DispatcherPriority priority, TimeSpan timeout, Delegate method, object arg, params object[] args);
member this.Invoke : System.Windows.Threading.DispatcherPriority * TimeSpan * Delegate * obj * obj[] -> obj
Public Function Invoke (priority As DispatcherPriority, timeout As TimeSpan, method As Delegate, arg As Object, ParamArray args As Object()) As Object
Parameter
- priority
- DispatcherPriority
Die Priorität, relativ zu den anderen anstehenden Operationen in der Dispatcher-Ereigniswarteschlange, mit der die angegebene Methode aufgerufen wird.The priority, relative to the other pending operations in the Dispatcher event queue, the specified method is invoked.
- timeout
- TimeSpan
Die maximale Zeit, die auf den Abschluss der Operation gewartet wird.The maximum time to wait for the operation to finish.
- method
- Delegate
Ein Delegat zu einer Methode, die mehrere Argumente erwartet und in die Dispatcher-Ereigniswarteschlange gestellt wird.A delegate to a method that takes multiple arguments, which is pushed onto the Dispatcher event queue.
- arg
- Object
Ein Objekt, das als Argument an die angegebene Methode übergeben wird.An object to pass as an argument to the specified method.
- args
- Object[]
Ein Array von Objekten, die als Argumente an die angegebene Methode übergeben werden sollen.An array of objects to pass as arguments to the specified method.
Gibt zurück
Der Rückgabewert des aufgerufenen Delegaten bzw. null
, wenn der Delegat keinen Wert zurückgibt.The return value from the delegate being invoked or null
if the delegate has no return value.
- Attribute
Ausnahmen
priority
ist kein gültiger DispatcherPriority.priority
is not a valid DispatcherPriority.
method
ist null
.method
is null
.
Hinweise
Arg
kann sein null
, wenn kein Argument benötigt wird.Arg
can be null
if an argument is not needed.
In WPFWPFkann nur der Thread, der einen DispatcherObject erstellt hat, auf dieses Objekt zugreifen.In WPFWPF, only the thread that created a DispatcherObject may access that object. Beispielsweise kann ein Hintergrund Thread, der aus dem Hauptbenutzer Oberflächen-Thread ausgelöst wird, den Inhalt eines Button nicht aktualisieren, der im UI-Thread erstellt wurde.For example, a background thread that is spun off from the main UI thread cannot update the contents of a Button that was created on the UI thread. Damit der Hintergrund Thread auf die Content-Eigenschaft von Buttonzugreifen kann, muss der Hintergrund Thread die Arbeit an die Dispatcher mit dem UI-Thread zugeordnete delegieren.In order for the background thread to access the Content property of the Button, the background thread must delegate the work to the Dispatcher associated with the UI thread. Dies wird mithilfe Invoke von oder BeginInvokeerreicht.This is accomplished by using either Invoke or BeginInvoke. Invokeist synchron und BeginInvoke ist asynchron.Invoke is synchronous and BeginInvoke is asynchronous. Der-Vorgang wird der-Ereignis Warteschlange Dispatcher von am angegebenen DispatcherPriorityhinzugefügt.The operation is added to the event queue of the Dispatcher at the specified DispatcherPriority.
Invokeist ein synchroner Vorgang. Daher wird die Steuerung erst wieder an das aufrufende Objekt zurückgegeben, nachdem der Rückruf zurückgegeben wurde.Invoke is a synchronous operation; therefore, control will not return to the calling object until after the callback returns.
Invoke(DispatcherPriority, TimeSpan, Delegate, Object)
Führt den angegebenen Delegaten mit der angegebenen Priorität und dem angegebenen Argument synchron auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate at the specified priority with the specified argument synchronously on the thread the Dispatcher is associated with.
public:
System::Object ^ Invoke(System::Windows::Threading::DispatcherPriority priority, TimeSpan timeout, Delegate ^ method, System::Object ^ arg);
[System.ComponentModel.Browsable(false)]
public object Invoke (System.Windows.Threading.DispatcherPriority priority, TimeSpan timeout, Delegate method, object arg);
member this.Invoke : System.Windows.Threading.DispatcherPriority * TimeSpan * Delegate * obj -> obj
Public Function Invoke (priority As DispatcherPriority, timeout As TimeSpan, method As Delegate, arg As Object) As Object
Parameter
- priority
- DispatcherPriority
Die Priorität, relativ zu den anderen anstehenden Operationen in der Dispatcher-Ereigniswarteschlange, mit der die angegebene Methode aufgerufen wird.The priority, relative to the other pending operations in the Dispatcher event queue, the specified method is invoked.
- timeout
- TimeSpan
Die maximale Zeit, die auf den Abschluss der Operation gewartet wird.The maximum time to wait for the operation to finish.
- method
- Delegate
Ein Delegat zu einer Methode, die mehrere Argumente erwartet und in die Dispatcher-Ereigniswarteschlange gestellt wird.A delegate to a method that takes multiple arguments, which is pushed onto the Dispatcher event queue.
- arg
- Object
Ein Objekt, das als Argument an die angegebene Methode übergeben werden soll.An object to pass as an argument to the given method. Dies kann null
sein, wenn keine Argumente benötigt werden.This can be null
if no arguments are needed.
Gibt zurück
Der Rückgabewert des aufgerufenen Delegaten bzw. null
, wenn der Delegat keinen Wert zurückgibt.The return value from the delegate being invoked or null
if the delegate has no return value.
- Attribute
Ausnahmen
priority
ist keine gültige Priorität.priority
is not a valid priority.
method
ist null
.method
is null
.
Hinweise
Arg
kann sein null
, wenn ein Argument nicht benötigt wird.Arg
can be null
if an argument is not needed
In WPFWPFkann nur der Thread, der einen DispatcherObject erstellt hat, auf dieses Objekt zugreifen.In WPFWPF, only the thread that created a DispatcherObject may access that object. Beispielsweise kann ein Hintergrund Thread, der aus dem Hauptbenutzer Oberflächen-Thread ausgelöst wird, den Inhalt eines Button nicht aktualisieren, der im UI-Thread erstellt wurde.For example, a background thread that is spun off from the main UI thread cannot update the contents of a Button that was created on the UI thread. Damit der Hintergrund Thread auf die Content-Eigenschaft von Buttonzugreifen kann, muss der Hintergrund Thread die Arbeit an die Dispatcher mit dem UI-Thread zugeordnete delegieren.In order for the background thread to access the Content property of the Button, the background thread must delegate the work to the Dispatcher associated with the UI thread. Dies wird mithilfe Invoke von oder BeginInvokeerreicht.This is accomplished by using either Invoke or BeginInvoke. Invokeist synchron und BeginInvoke ist asynchron.Invoke is synchronous and BeginInvoke is asynchronous. Der-Vorgang wird der-Ereignis Warteschlange Dispatcher von am angegebenen DispatcherPriorityhinzugefügt.The operation is added to the event queue of the Dispatcher at the specified DispatcherPriority.
Invokeist ein synchroner Vorgang. Daher wird die Steuerung erst wieder an das aufrufende Objekt zurückgegeben, nachdem der Rückruf zurückgegeben wurde.Invoke is a synchronous operation; therefore, control will not return to the calling object until after the callback returns.
Invoke(DispatcherPriority, Delegate, Object, Object[])
Führt den angegebenen Delegaten mit der angegebenen Priorität und den angegebenen Argumenten synchron auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate at the specified priority with the specified arguments synchronously on the thread the Dispatcher is associated with.
public:
System::Object ^ Invoke(System::Windows::Threading::DispatcherPriority priority, Delegate ^ method, System::Object ^ arg, ... cli::array <System::Object ^> ^ args);
[System.ComponentModel.Browsable(false)]
public object Invoke (System.Windows.Threading.DispatcherPriority priority, Delegate method, object arg, params object[] args);
member this.Invoke : System.Windows.Threading.DispatcherPriority * Delegate * obj * obj[] -> obj
Public Function Invoke (priority As DispatcherPriority, method As Delegate, arg As Object, ParamArray args As Object()) As Object
Parameter
- priority
- DispatcherPriority
Die Priorität, relativ zu den anderen anstehenden Operationen in der Dispatcher-Ereigniswarteschlange, mit der die angegebene Methode aufgerufen wird.The priority, relative to the other pending operations in the Dispatcher event queue, the specified method is invoked.
- method
- Delegate
Ein Delegat zu einer Methode, die mehrere Argumente erwartet und in die Dispatcher-Ereigniswarteschlange gestellt wird.A delegate to a method that takes multiple arguments, which is pushed onto the Dispatcher event queue.
- arg
- Object
Ein Objekt, das als Argument an die angegebene Methode übergeben werden soll.An object to pass as an argument to the given method.
- args
- Object[]
Ein Array von Objekten, die als Argumente an die angegebene Methode übergeben werden sollen.An array of objects to pass as arguments to the given method.
Gibt zurück
Der Rückgabewert des aufgerufenen Delegaten bzw. null
, wenn der Delegat keinen Wert zurückgibt.The return value from the delegate being invoked or null
if the delegate has no return value.
- Attribute
Ausnahmen
priority
ist keine gültige Priorität.priority
is not a valid priority.
method
ist null
.method
is null
.
Hinweise
Arg
kann sein null
, wenn ein Argument nicht benötigt wird.Arg
can be null
if an argument is not needed
In WPFWPFkann nur der Thread, der einen DispatcherObject erstellt hat, auf dieses Objekt zugreifen.In WPFWPF, only the thread that created a DispatcherObject may access that object. Beispielsweise kann ein Hintergrund Thread, der aus dem Hauptbenutzer Oberflächen-Thread ausgelöst wird, den Inhalt eines Button nicht aktualisieren, der im UI-Thread erstellt wurde.For example, a background thread that is spun off from the main UI thread cannot update the contents of a Button that was created on the UI thread. Damit der Hintergrund Thread auf die Content-Eigenschaft von Buttonzugreifen kann, muss der Hintergrund Thread die Arbeit an die Dispatcher mit dem UI-Thread zugeordnete delegieren.In order for the background thread to access the Content property of the Button, the background thread must delegate the work to the Dispatcher associated with the UI thread. Dies wird mithilfe Invoke von oder BeginInvokeerreicht.This is accomplished by using either Invoke or BeginInvoke. Invokeist synchron und BeginInvoke ist asynchron.Invoke is synchronous and BeginInvoke is asynchronous. Der-Vorgang wird der-Ereignis Warteschlange Dispatcher von am angegebenen DispatcherPriorityhinzugefügt.The operation is added to the event queue of the Dispatcher at the specified DispatcherPriority.
Invokeist ein synchroner Vorgang. Daher wird die Steuerung erst wieder an das aufrufende Objekt zurückgegeben, nachdem der Rückruf zurückgegeben wurde.Invoke is a synchronous operation; therefore, control will not return to the calling object until after the callback returns.
Invoke(Action, DispatcherPriority, CancellationToken, TimeSpan)
Führt die angegebene Action synchron mit der angegebenen Priorität auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Action synchronously at the specified priority on the thread the Dispatcher is associated with.
public:
void Invoke(Action ^ callback, System::Windows::Threading::DispatcherPriority priority, System::Threading::CancellationToken cancellationToken, TimeSpan timeout);
public void Invoke (Action callback, System.Windows.Threading.DispatcherPriority priority, System.Threading.CancellationToken cancellationToken, TimeSpan timeout);
member this.Invoke : Action * System.Windows.Threading.DispatcherPriority * System.Threading.CancellationToken * TimeSpan -> unit
Parameter
- callback
- Action
Ein Delegat, der über den Verteiler aufgerufen werden soll.A delegate to invoke through the dispatcher.
- priority
- DispatcherPriority
Die Priorität, die bestimmt, in welcher Reihenfolge der angegebene Rückruf relativ zu den anderen ausstehenden Vorgängen in Dispatcher aufgerufen wird.The priority that determines in what order the specified callback is invoked relative to the other pending operations in the Dispatcher.
- cancellationToken
- CancellationToken
Ein Objekt, das angibt, ob die Aktion abgebrochen werden kann.An object that indicates whether to cancel the action.
- timeout
- TimeSpan
Die minimale Zeitspanne, die auf den Start des Vorgangs gewartet wird.The minimum amount of time to wait for the operation to start.
Invoke(DispatcherPriority, TimeSpan, Delegate)
Führt den angegebenen Delegaten synchron mit der angegebenen Priorität und dem angegebenen Timeoutwert auf dem Thread aus, in dem der Dispatcher erstellt wurde.Executes the specified delegate synchronously at the specified priority and with the specified time-out value on the thread the Dispatcher was created.
public:
System::Object ^ Invoke(System::Windows::Threading::DispatcherPriority priority, TimeSpan timeout, Delegate ^ method);
[System.ComponentModel.Browsable(false)]
public object Invoke (System.Windows.Threading.DispatcherPriority priority, TimeSpan timeout, Delegate method);
member this.Invoke : System.Windows.Threading.DispatcherPriority * TimeSpan * Delegate -> obj
Public Function Invoke (priority As DispatcherPriority, timeout As TimeSpan, method As Delegate) As Object
Parameter
- priority
- DispatcherPriority
Die Priorität, relativ zu den anderen anstehenden Operationen in der Dispatcher-Ereigniswarteschlange, mit der die angegebene Methode aufgerufen wird.The priority, relative to the other pending operations in the Dispatcher event queue, the specified method is invoked.
- timeout
- TimeSpan
Die maximale Zeit, die auf den Abschluss der Operation gewartet wird.The maximum time to wait for the operation to finish.
- method
- Delegate
Der Delegat zu einer Methode, die keine Argumente erwartet und in die Dispatcher-Ereigniswarteschlange gestellt wird.The delegate to a method that takes no arguments, which is pushed onto the Dispatcher event queue.
Gibt zurück
Der Rückgabewert des aufgerufenen Delegaten bzw. null
, wenn der Delegat keinen Wert zurückgibt.The return value from the delegate being invoked or null
if the delegate has no return value.
- Attribute
Hinweise
In WPFWPFkann nur der Thread, der einen DispatcherObject erstellt hat, auf dieses Objekt zugreifen.In WPFWPF, only the thread that created a DispatcherObject may access that object. Beispielsweise kann ein Hintergrund Thread, der aus dem Hauptbenutzer Oberflächen-Thread ausgelöst wird, den Inhalt eines Button nicht aktualisieren, der im UI-Thread erstellt wurde.For example, a background thread that is spun off from the main UI thread cannot update the contents of a Button that was created on the UI thread. Damit der Hintergrund Thread auf die Content-Eigenschaft von Buttonzugreifen kann, muss der Hintergrund Thread die Arbeit an die Dispatcher mit dem UI-Thread zugeordnete delegieren.In order for the background thread to access the Content property of the Button, the background thread must delegate the work to the Dispatcher associated with the UI thread. Dies wird mithilfe Invoke von oder BeginInvokeerreicht.This is accomplished by using either Invoke or BeginInvoke. Invokeist synchron und BeginInvoke ist asynchron.Invoke is synchronous and BeginInvoke is asynchronous. Der-Vorgang wird der-Ereignis Warteschlange Dispatcher von am angegebenen DispatcherPriorityhinzugefügt.The operation is added to the event queue of the Dispatcher at the specified DispatcherPriority.
Invokeist ein synchroner Vorgang. Daher wird die Steuerung erst wieder an das aufrufende Objekt zurückgegeben, nachdem der Rückruf zurückgegeben wurde.Invoke is a synchronous operation; therefore, control will not return to the calling object until after the callback returns.
Invoke(DispatcherPriority, Delegate, Object)
Führt den angegebenen Delegaten mit der angegebenen Priorität und dem angegebenen Argument synchron auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate at the specified priority with the specified argument synchronously on the thread the Dispatcher is associated with.
public:
System::Object ^ Invoke(System::Windows::Threading::DispatcherPriority priority, Delegate ^ method, System::Object ^ arg);
[System.ComponentModel.Browsable(false)]
public object Invoke (System.Windows.Threading.DispatcherPriority priority, Delegate method, object arg);
member this.Invoke : System.Windows.Threading.DispatcherPriority * Delegate * obj -> obj
Public Function Invoke (priority As DispatcherPriority, method As Delegate, arg As Object) As Object
Parameter
- priority
- DispatcherPriority
Die Priorität, relativ zu den anderen anstehenden Operationen in der Dispatcher-Ereigniswarteschlange, mit der die angegebene Methode aufgerufen wird.The priority, relative to the other pending operations in the Dispatcher event queue, the specified method is invoked.
- method
- Delegate
Ein Delegat zu einer Methode, die ein Argument erwartet und in die Dispatcher-Ereigniswarteschlange gestellt wird.A delegate to a method that takes one argument, which is pushed onto the Dispatcher event queue.
- arg
- Object
Ein Objekt, das als Argument an die angegebene Methode übergeben werden soll.An object to pass as an argument to the given method.
Gibt zurück
Der Rückgabewert des aufgerufenen Delegaten bzw. null
, wenn der Delegat keinen Wert zurückgibt.The return value from the delegate being invoked or null
if the delegate has no return value.
- Attribute
Ausnahmen
priority
ist keine gültige Priorität.priority
is not a valid priority.
method
ist null
.method
is null
.
Hinweise
Arg
kann sein null
, wenn ein Argument nicht benötigt wird.Arg
can be null
if an argument is not needed
In WPFWPFkann nur der Thread, der einen DispatcherObject erstellt hat, auf dieses Objekt zugreifen.In WPFWPF, only the thread that created a DispatcherObject may access that object. Beispielsweise kann ein Hintergrund Thread, der aus dem Hauptbenutzer Oberflächen-Thread ausgelöst wird, den Inhalt eines Button nicht aktualisieren, der im UI-Thread erstellt wurde.For example, a background thread that is spun off from the main UI thread cannot update the contents of a Button that was created on the UI thread. Damit der Hintergrund Thread auf die Content-Eigenschaft von Buttonzugreifen kann, muss der Hintergrund Thread die Arbeit an die Dispatcher mit dem UI-Thread zugeordnete delegieren.In order for the background thread to access the Content property of the Button, the background thread must delegate the work to the Dispatcher associated with the UI thread. Dies wird mithilfe Invoke von oder BeginInvokeerreicht.This is accomplished by using either Invoke or BeginInvoke. Invokeist synchron und BeginInvoke ist asynchron.Invoke is synchronous and BeginInvoke is asynchronous. Der-Vorgang wird der-Ereignis Warteschlange Dispatcher von am angegebenen DispatcherPriorityhinzugefügt.The operation is added to the event queue of the Dispatcher at the specified DispatcherPriority.
Invokeist ein synchroner Vorgang. Daher wird die Steuerung erst wieder an das aufrufende Objekt zurückgegeben, nachdem der Rückruf zurückgegeben wurde.Invoke is a synchronous operation; therefore, control will not return to the calling object until after the callback returns.
Invoke(Delegate, TimeSpan, DispatcherPriority, Object[])
Führt den angegebenen Delegaten in der angegebenen Zeitspanne mit der angegebenen Priorität und den angegebenen Argumenten synchron für den Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate within the designated time span at the specified priority with the specified arguments synchronously on the thread the Dispatcher is associated with.
public:
System::Object ^ Invoke(Delegate ^ method, TimeSpan timeout, System::Windows::Threading::DispatcherPriority priority, ... cli::array <System::Object ^> ^ args);
public object Invoke (Delegate method, TimeSpan timeout, System.Windows.Threading.DispatcherPriority priority, params object[] args);
member this.Invoke : Delegate * TimeSpan * System.Windows.Threading.DispatcherPriority * obj[] -> obj
Public Function Invoke (method As Delegate, timeout As TimeSpan, priority As DispatcherPriority, ParamArray args As Object()) As Object
Parameter
- method
- Delegate
Ein Delegat für eine Methode, die in args
angegebene Parameter akzeptiert und in die Dispatcher-Ereigniswarteschlange gestellt wird.A delegate to a method that takes parameters specified in args
, which is pushed onto the Dispatcher event queue.
- timeout
- TimeSpan
Die maximale Zeitspanne, die auf den Abschluss der Operation gewartet wird.The maximum amount of time to wait for the operation to complete.
- priority
- DispatcherPriority
Die Priorität, relativ zu den anderen anstehenden Operationen in der Dispatcher-Ereigniswarteschlange, mit der die angegebene Methode aufgerufen wird.The priority, relative to the other pending operations in the Dispatcher event queue, the specified method is invoked.
- args
- Object[]
Ein Array von Objekten, die als Argumente an die angegebene Methode übergeben werden sollen.An array of objects to pass as arguments to the given method. Kann null
sein.Can be null
.
Gibt zurück
Der Rückgabewert des aufgerufenen Delegaten bzw. null
, wenn der Delegat keinen Wert zurückgibt.The return value from the delegate being invoked or null
if the delegate has no return value.
Hinweise
In WPFWPFkann nur der Thread, der einen DispatcherObject erstellt hat, auf dieses Objekt zugreifen.In WPFWPF, only the thread that created a DispatcherObject may access that object. Beispielsweise kann ein Hintergrund Thread, der aus dem Hauptbenutzer Oberflächen-Thread ausgelöst wird, den Inhalt eines Button nicht aktualisieren, der im UI-Thread erstellt wurde.For example, a background thread that is spun off from the main UI thread cannot update the contents of a Button that was created on the UI thread. Damit der Hintergrund Thread auf die Content-Eigenschaft von Buttonzugreifen kann, muss der Hintergrund Thread die Arbeit an die Dispatcher mit dem UI-Thread zugeordnete delegieren.In order for the background thread to access the Content property of the Button, the background thread must delegate the work to the Dispatcher associated with the UI thread. Dies wird mithilfe Invoke von oder BeginInvokeerreicht.This is accomplished by using either Invoke or BeginInvoke. Invokeist synchron und BeginInvoke ist asynchron.Invoke is synchronous and BeginInvoke is asynchronous. Der-Vorgang wird der-Ereignis Warteschlange Dispatcher von am angegebenen DispatcherPriorityhinzugefügt.The operation is added to the event queue of the Dispatcher at the specified DispatcherPriority.
Invokeist ein synchroner Vorgang. Daher wird die Steuerung erst wieder an das aufrufende Objekt zurückgegeben, nachdem der Rückruf zurückgegeben wurde.Invoke is a synchronous operation; therefore, control will not return to the calling object until after the callback returns.
Invoke(Delegate, TimeSpan, Object[])
Führt den angegebenen Delegaten in der angegebenen Zeitspanne mit der angegebenen Priorität und den angegebenen Argumenten synchron für den Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate within the designated time span at the specified priority with the specified arguments synchronously on the thread the Dispatcher is associated with.
public:
System::Object ^ Invoke(Delegate ^ method, TimeSpan timeout, ... cli::array <System::Object ^> ^ args);
public object Invoke (Delegate method, TimeSpan timeout, params object[] args);
member this.Invoke : Delegate * TimeSpan * obj[] -> obj
Public Function Invoke (method As Delegate, timeout As TimeSpan, ParamArray args As Object()) As Object
Parameter
- method
- Delegate
Ein Delegat für eine Methode, die in args
angegebene Parameter akzeptiert und in die Dispatcher-Ereigniswarteschlange gestellt wird.A delegate to a method that takes parameters specified in args
, which is pushed onto the Dispatcher event queue.
- timeout
- TimeSpan
Die maximale Zeitspanne, die auf den Abschluss der Operation gewartet wird.The maximum amount of time to wait for the operation to complete.
- args
- Object[]
Ein Array von Objekten, die als Argumente an die angegebene Methode übergeben werden sollen.An array of objects to pass as arguments to the given method. Kann null
sein.Can be null
.
Gibt zurück
Der Rückgabewert des aufgerufenen Delegaten bzw. null
, wenn der Delegat keinen Wert zurückgibt.The return value from the delegate being invoked or null
if the delegate has no return value.
Hinweise
In WPFWPFkann nur der Thread, der einen DispatcherObject erstellt hat, auf dieses Objekt zugreifen.In WPFWPF, only the thread that created a DispatcherObject may access that object. Beispielsweise kann ein Hintergrund Thread, der aus dem Hauptbenutzer Oberflächen-Thread ausgelöst wird, den Inhalt eines Button nicht aktualisieren, der im UI-Thread erstellt wurde.For example, a background thread that is spun off from the main UI thread cannot update the contents of a Button that was created on the UI thread. Damit der Hintergrund Thread auf die Content-Eigenschaft von Buttonzugreifen kann, muss der Hintergrund Thread die Arbeit an die Dispatcher mit dem UI-Thread zugeordnete delegieren.In order for the background thread to access the Content property of the Button, the background thread must delegate the work to the Dispatcher associated with the UI thread. Dies wird mithilfe Invoke von oder BeginInvokeerreicht.This is accomplished by using either Invoke or BeginInvoke. Invokeist synchron und BeginInvoke ist asynchron.Invoke is synchronous and BeginInvoke is asynchronous. Der-Vorgang wird der-Ereignis Warteschlange Dispatcher von am angegebenen DispatcherPriorityhinzugefügt.The operation is added to the event queue of the Dispatcher at the specified DispatcherPriority.
Invokeist ein synchroner Vorgang. Daher wird die Steuerung erst wieder an das aufrufende Objekt zurückgegeben, nachdem der Rückruf zurückgegeben wurde.Invoke is a synchronous operation; therefore, control will not return to the calling object until after the callback returns.
Invoke(Action, DispatcherPriority, CancellationToken)
Führt die angegebene Action synchron mit der angegebenen Priorität auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Action synchronously at the specified priority on the thread the Dispatcher is associated with.
public:
void Invoke(Action ^ callback, System::Windows::Threading::DispatcherPriority priority, System::Threading::CancellationToken cancellationToken);
public void Invoke (Action callback, System.Windows.Threading.DispatcherPriority priority, System.Threading.CancellationToken cancellationToken);
member this.Invoke : Action * System.Windows.Threading.DispatcherPriority * System.Threading.CancellationToken -> unit
Parameter
- callback
- Action
Ein Delegat, der über den Verteiler aufgerufen werden soll.A delegate to invoke through the dispatcher.
- priority
- DispatcherPriority
Die Priorität, die bestimmt, in welcher Reihenfolge der angegebene Rückruf relativ zu den anderen ausstehenden Vorgängen in Dispatcher aufgerufen wird.The priority that determines in what order the specified callback is invoked relative to the other pending operations in the Dispatcher.
- cancellationToken
- CancellationToken
Ein Objekt, das angibt, ob die Aktion abgebrochen werden kann.An object that indicates whether to cancel the action.
Invoke(DispatcherPriority, Delegate)
Führt den angegebenen Delegaten synchron mit der angegebenen Priorität auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate synchronously at the specified priority on the thread on which the Dispatcher is associated with.
public:
System::Object ^ Invoke(System::Windows::Threading::DispatcherPriority priority, Delegate ^ method);
[System.ComponentModel.Browsable(false)]
public object Invoke (System.Windows.Threading.DispatcherPriority priority, Delegate method);
member this.Invoke : System.Windows.Threading.DispatcherPriority * Delegate -> obj
Public Function Invoke (priority As DispatcherPriority, method As Delegate) As Object
Parameter
- priority
- DispatcherPriority
Die Priorität, relativ zu den anderen anstehenden Operationen in der Dispatcher-Ereigniswarteschlange, mit der die angegebene Methode aufgerufen wird.The priority, relative to the other pending operations in the Dispatcher event queue, the specified method is invoked.
- method
- Delegate
Ein Delegat zu einer Methode, die keine Argumente erwartet und in die Dispatcher-Ereigniswarteschlange gestellt wird.A delegate to a method that takes no arguments, which is pushed onto the Dispatcher event queue.
Gibt zurück
Der Rückgabewert des aufgerufenen Delegaten bzw. null
, wenn der Delegat keinen Wert zurückgibt.The return value from the delegate being invoked or null
if the delegate has no return value.
- Attribute
Ausnahmen
priority
ist keine gültige Priorität.priority
is not a valid priority.
method
ist null
.method
is null
.
Beispiele
Im folgenden Beispiel wird ein Delegat unter Dispatcher Verwendung Normal Invokevon auf einen platziert.The following example places a delegate onto a Dispatcher at Normal using Invoke.
// Places the delegate onto the UI Thread's Dispatcher
private void timer_Elapsed(object sender, ElapsedEventArgs e)
{
// Place delegate on the Dispatcher.
this.Dispatcher.Invoke(DispatcherPriority.Normal,
new TimerDispatcherDelegate(TimerWorkItem));
}
' Places the delegate onto the UI Thread's Dispatcher
Private Sub timer_Elapsed(ByVal sender As Object, ByVal e As ElapsedEventArgs)
' Place delegate on the Dispatcher.
Me.Dispatcher.Invoke(DispatcherPriority.Normal, New TimerDispatcherDelegate(AddressOf TimerWorkItem))
End Sub
Hinweise
In WPFWPFkann nur der Thread, der einen DispatcherObject erstellt hat, auf dieses Objekt zugreifen.In WPFWPF, only the thread that created a DispatcherObject may access that object. Beispielsweise kann ein Hintergrund Thread, der aus dem Hauptbenutzer Oberflächen-Thread ausgelöst wird, den Inhalt eines Button nicht aktualisieren, der im UI-Thread erstellt wurde.For example, a background thread that is spun off from the main UI thread cannot update the contents of a Button that was created on the UI thread. Damit der Hintergrund Thread auf die Content-Eigenschaft von Buttonzugreifen kann, muss der Hintergrund Thread die Arbeit an die Dispatcher mit dem UI-Thread zugeordnete delegieren.In order for the background thread to access the Content property of the Button, the background thread must delegate the work to the Dispatcher associated with the UI thread. Dies wird mithilfe Invoke von oder BeginInvokeerreicht.This is accomplished by using either Invoke or BeginInvoke. Invokeist synchron und BeginInvoke ist asynchron.Invoke is synchronous and BeginInvoke is asynchronous. Der-Vorgang wird der-Ereignis Warteschlange Dispatcher von am angegebenen DispatcherPriorityhinzugefügt.The operation is added to the event queue of the Dispatcher at the specified DispatcherPriority.
Invokeist ein synchroner Vorgang. Daher wird die Steuerung erst wieder an das aufrufende Objekt zurückgegeben, nachdem der Rückruf zurückgegeben wurde.Invoke is a synchronous operation; therefore, control will not return to the calling object until after the callback returns.
Invoke(Delegate, Object[])
Führt den angegebenen Delegaten synchron mit den angegebenen Argumenten für den Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate with the specified arguments synchronously on the thread the Dispatcher is associated with.
public:
System::Object ^ Invoke(Delegate ^ method, ... cli::array <System::Object ^> ^ args);
public object Invoke (Delegate method, params object[] args);
member this.Invoke : Delegate * obj[] -> obj
Public Function Invoke (method As Delegate, ParamArray args As Object()) As Object
Parameter
- method
- Delegate
Ein Delegat für eine Methode, die in args
angegebene Parameter akzeptiert und in die Dispatcher-Ereigniswarteschlange gestellt wird.A delegate to a method that takes parameters specified in args
, which is pushed onto the Dispatcher event queue.
- args
- Object[]
Ein Array von Objekten, die als Argumente an die angegebene Methode übergeben werden sollen.An array of objects to pass as arguments to the given method. Kann null
sein.Can be null
.
Gibt zurück
Der Rückgabewert des aufgerufenen Delegaten bzw. null
, wenn der Delegat keinen Wert zurückgibt.The return value from the delegate being invoked or null
if the delegate has no return value.
Hinweise
In WPFWPFkann nur der Thread, der einen DispatcherObject erstellt hat, auf dieses Objekt zugreifen.In WPFWPF, only the thread that created a DispatcherObject may access that object. Beispielsweise kann ein Hintergrund Thread, der aus dem Hauptbenutzer Oberflächen-Thread ausgelöst wird, den Inhalt eines Button nicht aktualisieren, der im UI-Thread erstellt wurde.For example, a background thread that is spun off from the main UI thread cannot update the contents of a Button that was created on the UI thread. Damit der Hintergrund Thread auf die Content-Eigenschaft von Buttonzugreifen kann, muss der Hintergrund Thread die Arbeit an die Dispatcher mit dem UI-Thread zugeordnete delegieren.In order for the background thread to access the Content property of the Button, the background thread must delegate the work to the Dispatcher associated with the UI thread. Dies wird mithilfe Invoke von oder BeginInvokeerreicht.This is accomplished by using either Invoke or BeginInvoke. Invokeist synchron und BeginInvoke ist asynchron.Invoke is synchronous and BeginInvoke is asynchronous. Der-Vorgang wird der-Ereignis Warteschlange Dispatcher von am angegebenen DispatcherPriorityhinzugefügt.The operation is added to the event queue of the Dispatcher at the specified DispatcherPriority.
Invokeist ein synchroner Vorgang. Daher wird die Steuerung erst wieder an das aufrufende Objekt zurückgegeben, nachdem der Rückruf zurückgegeben wurde.Invoke is a synchronous operation; therefore, control will not return to the calling object until after the callback returns.
Invoke(Action, DispatcherPriority)
Führt die angegebene Action synchron mit der angegebenen Priorität auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Action synchronously at the specified priority on the thread the Dispatcher is associated with.
public:
void Invoke(Action ^ callback, System::Windows::Threading::DispatcherPriority priority);
public void Invoke (Action callback, System.Windows.Threading.DispatcherPriority priority);
member this.Invoke : Action * System.Windows.Threading.DispatcherPriority -> unit
Public Sub Invoke (callback As Action, priority As DispatcherPriority)
Parameter
- callback
- Action
Ein Delegat, der über den Verteiler aufgerufen werden soll.A delegate to invoke through the dispatcher.
- priority
- DispatcherPriority
Die Priorität, die bestimmt, in welcher Reihenfolge der angegebene Rückruf relativ zu den anderen ausstehenden Vorgängen in Dispatcher aufgerufen wird.The priority that determines in what order the specified callback is invoked relative to the other pending operations in the Dispatcher.
Invoke(Action)
Führt die angegebene Action synchron auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Action synchronously on the thread the Dispatcher is associated with.
public:
void Invoke(Action ^ callback);
public void Invoke (Action callback);
member this.Invoke : Action -> unit
Public Sub Invoke (callback As Action)
Parameter
- callback
- Action
Ein Delegat, der über den Verteiler aufgerufen werden soll.A delegate to invoke through the dispatcher.
Invoke(Delegate, DispatcherPriority, Object[])
Führt den angegebenen Delegaten mit der angegebenen Priorität und den angegebenen Argumenten synchron auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified delegate at the specified priority with the specified arguments synchronously on the thread the Dispatcher is associated with.
public:
System::Object ^ Invoke(Delegate ^ method, System::Windows::Threading::DispatcherPriority priority, ... cli::array <System::Object ^> ^ args);
public object Invoke (Delegate method, System.Windows.Threading.DispatcherPriority priority, params object[] args);
member this.Invoke : Delegate * System.Windows.Threading.DispatcherPriority * obj[] -> obj
Public Function Invoke (method As Delegate, priority As DispatcherPriority, ParamArray args As Object()) As Object
Parameter
- method
- Delegate
Ein Delegat für eine Methode, die in args
angegebene Parameter akzeptiert und in die Dispatcher-Ereigniswarteschlange gestellt wird.A delegate to a method that takes parameters specified in args
, which is pushed onto the Dispatcher event queue.
- priority
- DispatcherPriority
Die Priorität, relativ zu den anderen anstehenden Operationen in der Dispatcher-Ereigniswarteschlange, mit der die angegebene Methode aufgerufen wird.The priority, relative to the other pending operations in the Dispatcher event queue, the specified method is invoked.
- args
- Object[]
Ein Array von Objekten, die als Argumente an die angegebene Methode übergeben werden sollen.An array of objects to pass as arguments to the given method. Kann null
sein.Can be null
.
Gibt zurück
Der Rückgabewert des aufgerufenen Delegaten bzw. null
, wenn der Delegat keinen Wert zurückgibt.The return value from the delegate being invoked or null
if the delegate has no return value.
Hinweise
In WPFWPFkann nur der Thread, der einen DispatcherObject erstellt hat, auf dieses Objekt zugreifen.In WPFWPF, only the thread that created a DispatcherObject may access that object. Beispielsweise kann ein Hintergrund Thread, der aus dem Hauptbenutzer Oberflächen-Thread ausgelöst wird, den Inhalt eines Button nicht aktualisieren, der im UI-Thread erstellt wurde.For example, a background thread that is spun off from the main UI thread cannot update the contents of a Button that was created on the UI thread. Damit der Hintergrund Thread auf die Content-Eigenschaft von Buttonzugreifen kann, muss der Hintergrund Thread die Arbeit an die Dispatcher mit dem UI-Thread zugeordnete delegieren.In order for the background thread to access the Content property of the Button, the background thread must delegate the work to the Dispatcher associated with the UI thread. Dies wird mithilfe Invoke von oder BeginInvokeerreicht.This is accomplished by using either Invoke or BeginInvoke. Invokeist synchron und BeginInvoke ist asynchron.Invoke is synchronous and BeginInvoke is asynchronous. Der-Vorgang wird der-Ereignis Warteschlange Dispatcher von am angegebenen DispatcherPriorityhinzugefügt.The operation is added to the event queue of the Dispatcher at the specified DispatcherPriority.
Invokeist ein synchroner Vorgang. Daher wird die Steuerung erst wieder an das aufrufende Objekt zurückgegeben, nachdem der Rückruf zurückgegeben wurde.Invoke is a synchronous operation; therefore, control will not return to the calling object until after the callback returns.
Invoke<TResult>(Func<TResult>)
Führt die angegebene Func<TResult> synchron auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Func<TResult> synchronously on the thread the Dispatcher is associated with.
public:
generic <typename TResult>
TResult Invoke(Func<TResult> ^ callback);
public TResult Invoke<TResult> (Func<TResult> callback);
member this.Invoke : Func<'Result> -> 'Result
Public Function Invoke(Of TResult) (callback As Func(Of TResult)) As TResult
Typparameter
- TResult
Der Rückgabewerts des angegebenen Delegaten.The return value type of the specified delegate.
Parameter
- callback
- Func<TResult>
Ein Delegat, der über den Verteiler aufgerufen werden soll.A delegate to invoke through the dispatcher.
Gibt zurück
Hinweise
Der von callback
zurückgegebene Wert.The value returned by callback
.
Invoke<TResult>(Func<TResult>, DispatcherPriority)
Führt die angegebene Func<TResult> synchron mit der angegebenen Priorität auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Func<TResult> synchronously at the specified priority on the thread the Dispatcher is associated with.
public:
generic <typename TResult>
TResult Invoke(Func<TResult> ^ callback, System::Windows::Threading::DispatcherPriority priority);
public TResult Invoke<TResult> (Func<TResult> callback, System.Windows.Threading.DispatcherPriority priority);
member this.Invoke : Func<'Result> * System.Windows.Threading.DispatcherPriority -> 'Result
Public Function Invoke(Of TResult) (callback As Func(Of TResult), priority As DispatcherPriority) As TResult
Typparameter
- TResult
Der Rückgabewerts des angegebenen Delegaten.The return value type of the specified delegate.
Parameter
- callback
- Func<TResult>
Ein Delegat, der über den Verteiler aufgerufen werden soll.A delegate to invoke through the dispatcher.
- priority
- DispatcherPriority
Die Priorität, die bestimmt, in welcher Reihenfolge der angegebene Rückruf relativ zu den anderen ausstehenden Vorgängen in Dispatcher aufgerufen wird.The priority that determines in what order the specified callback is invoked relative to the other pending operations in the Dispatcher.
Gibt zurück
Hinweise
Der von callback
zurückgegebene Wert.The value returned by callback
.
Invoke<TResult>(Func<TResult>, DispatcherPriority, CancellationToken)
Führt die angegebene Func<TResult> synchron mit der angegebenen Priorität auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Func<TResult> synchronously at the specified priority on the thread the Dispatcher is associated with.
public:
generic <typename TResult>
TResult Invoke(Func<TResult> ^ callback, System::Windows::Threading::DispatcherPriority priority, System::Threading::CancellationToken cancellationToken);
public TResult Invoke<TResult> (Func<TResult> callback, System.Windows.Threading.DispatcherPriority priority, System.Threading.CancellationToken cancellationToken);
member this.Invoke : Func<'Result> * System.Windows.Threading.DispatcherPriority * System.Threading.CancellationToken -> 'Result
Typparameter
- TResult
Der Rückgabewerts des angegebenen Delegaten.The return value type of the specified delegate.
Parameter
- callback
- Func<TResult>
Ein Delegat, der über den Verteiler aufgerufen werden soll.A delegate to invoke through the dispatcher.
- priority
- DispatcherPriority
Die Priorität, die bestimmt, in welcher Reihenfolge der angegebene Rückruf relativ zu den anderen ausstehenden Vorgängen in Dispatcher aufgerufen wird.The priority that determines in what order the specified callback is invoked relative to the other pending operations in the Dispatcher.
- cancellationToken
- CancellationToken
Ein Objekt, das angibt, ob der Vorgang abgebrochen werden kann.An object that indicates whether to cancel the operation.
Gibt zurück
Hinweise
Der von callback
zurückgegebene Wert.The value returned by callback
.
Invoke<TResult>(Func<TResult>, DispatcherPriority, CancellationToken, TimeSpan)
Führt die angegebene Func<TResult> synchron mit der angegebenen Priorität auf dem Thread aus, dem der Dispatcher zugeordnet ist.Executes the specified Func<TResult> synchronously at the specified priority on the thread the Dispatcher is associated with.
public:
generic <typename TResult>
TResult Invoke(Func<TResult> ^ callback, System::Windows::Threading::DispatcherPriority priority, System::Threading::CancellationToken cancellationToken, TimeSpan timeout);
public TResult Invoke<TResult> (Func<TResult> callback, System.Windows.Threading.DispatcherPriority priority, System.Threading.CancellationToken cancellationToken, TimeSpan timeout);
member this.Invoke : Func<'Result> * System.Windows.Threading.DispatcherPriority * System.Threading.CancellationToken * TimeSpan -> 'Result
Typparameter
- TResult
Der Rückgabewerts des angegebenen Delegaten.The return value type of the specified delegate.
Parameter
- callback
- Func<TResult>
Ein Delegat, der über den Verteiler aufgerufen werden soll.A delegate to invoke through the dispatcher.
- priority
- DispatcherPriority
Die Priorität, die bestimmt, in welcher Reihenfolge der angegebene Rückruf relativ zu den anderen ausstehenden Vorgängen in Dispatcher aufgerufen wird.The priority that determines in what order the specified callback is invoked relative to the other pending operations in the Dispatcher.
- cancellationToken
- CancellationToken
Ein Objekt, das angibt, ob der Vorgang abgebrochen werden kann.An object that indicates whether to cancel the operation.
- timeout
- TimeSpan
Die minimale Zeitspanne, die auf den Start des Vorgangs gewartet wird.The minimum amount of time to wait for the operation to start.
Gibt zurück
Hinweise
Der von callback
zurückgegebene Wert.The value returned by callback
.