共用方式為


WorkerThreadElementContainer Class

This class is used to connect the UI elements in worker threads to Main Window.

Namespace:  Microsoft.VisualStudio.PlatformUI
Assembly:  Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)

Syntax

'宣告
Public MustInherit Class WorkerThreadElementContainer _
    Inherits FrameworkElement
'用途
Dim instance As WorkerThreadElementContainer
public abstract class WorkerThreadElementContainer : FrameworkElement
public ref class WorkerThreadElementContainer abstract : public FrameworkElement
[<AbstractClassAttribute>]
type WorkerThreadElementContainer =  
    class
        inherit FrameworkElement
    end
public abstract class WorkerThreadElementContainer extends FrameworkElement

Remarks

One key thing for this class is that, communications between main thread and worker thread are always accomplished with Dispatcher.BeginInvoke instead of Dispatcher.Invoke because sometimes these threads can run into deadlock situations as latter call wouldn't return unless Dispatcher processes it. For example first arrange pass of the main thread UI would cause the worker thread UI to arrange itself as we delegate that to worker thread but then worker thread UI needs to access the data model properties which is handled by the across thread COM calls via window messages.

Inheritance Hierarchy

System.Object
  System.Windows.Threading.DispatcherObject
    System.Windows.DependencyObject
      System.Windows.Media.Visual
        System.Windows.UIElement
          System.Windows.FrameworkElement
            Microsoft.VisualStudio.PlatformUI.WorkerThreadElementContainer

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

WorkerThreadElementContainer Members

Microsoft.VisualStudio.PlatformUI Namespace