WorkflowDesignerMessageFilter WorkflowDesignerMessageFilter WorkflowDesignerMessageFilter WorkflowDesignerMessageFilter Class

Definición

Advertencia

Esta API está ya obsoleta.

Proporciona una clase base para todos los filtros de mensajes del flujo de trabajo.Provides a base class for all workflow message filters.

public ref class WorkflowDesignerMessageFilter abstract : IDisposable
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public abstract class WorkflowDesignerMessageFilter : IDisposable
type WorkflowDesignerMessageFilter = class
    interface IDisposable
Public MustInherit Class WorkflowDesignerMessageFilter
Implements IDisposable
Herencia
WorkflowDesignerMessageFilterWorkflowDesignerMessageFilterWorkflowDesignerMessageFilterWorkflowDesignerMessageFilter
Atributos
Implementaciones

Ejemplos

En el ejemplo de código siguiente se muestra un filtro de mensajes del diseñador personalizado derivado de WorkflowDesignerMessageFilter.The following code example shows a custom designer message filter that derives from WorkflowDesignerMessageFilter. La clase, denominada CustomMessageFilter, invalida varios de sus métodos de clase base, como OnMouseDown, OnMouseMove, OnMouseUp, OnMouseDoubleClick, OnMouseEnter, OnMouseHover, OnMouseLeave, OnDragEnter, OnDragOver y OnKeyDown.The class, named CustomMessageFilter, overrides a number of its base class methods including OnMouseDown, OnMouseMove, OnMouseUp, OnMouseDoubleClick, OnMouseEnter, OnMouseHover, OnMouseLeave, OnDragEnter, OnDragOver, and OnKeyDown.

Este ejemplo de código forma parte del ejemplo de SDK de hospedaje de diseñador básico del archivo DesignerShell.cs.This code example is part of the Basic Designer Hosting SDK Sample from the DesignerShell.cs file. Para obtener más información, vea hospedaje de diseñador básico.For more information, see Basic Designer Hosting.

internal sealed class CustomMessageFilter : WorkflowDesignerMessageFilter
{
    #region Members and Constructor

    private bool mouseDown;
    private IServiceProvider serviceProvider;
    private WorkflowView workflowView;
    private WorkflowDesignerLoader loader;

    public CustomMessageFilter(IServiceProvider provider, WorkflowView workflowView, WorkflowDesignerLoader loader)
    {
        this.serviceProvider = provider;
        this.workflowView = workflowView;
        this.loader = loader;
    }

    #endregion

    #region MessageFilter Overridables

    protected override bool OnMouseDown(MouseEventArgs eventArgs)
    {
        //Allow other components to process this event by not returning true.
        this.mouseDown = true;
        return false;
    }

    protected override bool OnMouseMove(MouseEventArgs eventArgs)
    {
        //Allow other components to process this event by not returning true.
        if (mouseDown)
        {
            workflowView.ScrollPosition = new Point(eventArgs.X, eventArgs.Y);
        }
        return false;
    }

    protected override bool OnMouseUp(MouseEventArgs eventArgs)
    {
        //Allow other components to process this event by not returning true.
        mouseDown = false;
        return false;
    }

    protected override bool OnMouseDoubleClick(MouseEventArgs eventArgs)
    {
        mouseDown = false;
        return true;
    }

    protected override bool OnMouseEnter(MouseEventArgs eventArgs)
    {
        //Allow other components to process this event by not returning true.
        mouseDown = false;
        return false;
    }

    protected override bool OnMouseHover(MouseEventArgs eventArgs)
    {
        //Allow other components to process this event by not returning true.
        mouseDown = false;
        return false;
    }

    protected override bool OnMouseLeave()
    {
        //Allow other components to process this event by not returning true.
        mouseDown = false;
        return false;
    }

    protected override bool OnMouseWheel(MouseEventArgs eventArgs)
    {
        mouseDown = false;
        return true;
    }

    protected override bool OnMouseCaptureChanged()
    {
        //Allow other components to process this event by not returning true.
        mouseDown = false;
        return false;
    }

    protected override bool OnDragEnter(DragEventArgs eventArgs)
    {
        return true;
    }

    protected override bool OnDragOver(DragEventArgs eventArgs)
    {
        return true;
    }

    protected override bool OnDragLeave()
    {
        return true;
    }

    protected override bool OnDragDrop(DragEventArgs eventArgs)
    {
        return true;
    }

    protected override bool OnGiveFeedback(GiveFeedbackEventArgs gfbevent)
    {
        return true;
    }

    protected override bool OnQueryContinueDrag(QueryContinueDragEventArgs qcdevent)
    {
        return true;
    }

    protected override bool OnKeyDown(KeyEventArgs eventArgs)
    {
        if (eventArgs.KeyCode == Keys.Delete)
        {
            ISelectionService selectionService = (ISelectionService)serviceProvider.GetService(typeof(ISelectionService));
            if (selectionService != null && selectionService.PrimarySelection is CodeActivity)
            {
                CodeActivity codeActivityComponent = (CodeActivity)selectionService.PrimarySelection;
                CompositeActivity parentActivity = codeActivityComponent.Parent;
                if (parentActivity != null)
                {
                    parentActivity.Activities.Remove(codeActivityComponent);
                    this.ParentView.Update();
                }
                loader.RemoveActivityFromDesigner(codeActivityComponent);

            }
        }
        return true;
    }

    protected override bool OnKeyUp(KeyEventArgs eventArgs)
    {
        return true;
    }

    protected override bool OnShowContextMenu(Point menuPoint)
    {
        return true;
    }

    #endregion
}
    Friend NotInheritable Class CustomMessageFilter
        Inherits WorkflowDesignerMessageFilter

#Region "Members and Constructor"

        Private mouseDown As Boolean
        Private serviceProvider As IServiceProvider
        Private workflowView As WorkflowView
        Private loader As WorkflowDesignerLoader

        Public Sub New(ByVal provider As IServiceProvider, ByVal workflowView As WorkflowView, ByVal loader As WorkflowDesignerLoader)
            Me.serviceProvider = provider
            Me.workflowView = workflowView
            Me.loader = loader
        End Sub

#End Region

#Region "WorkflowDesignerMessageFilter Overridables"

        Protected Overrides Function OnMouseDown(ByVal eventArgs As System.Windows.Forms.MouseEventArgs) As Boolean
            ' Allow other components to process this event by not returning true.
            mouseDown = True
            Return False
        End Function

        Protected Overrides Function OnMouseMove(ByVal eventArgs As System.Windows.Forms.MouseEventArgs) As Boolean
            ' Allow other components to process this event by not returning true.
            If mouseDown Then
                workflowView.ScrollPosition = New Point(eventArgs.X, eventArgs.Y)
            End If
            Return False
        End Function

        Protected Overrides Function OnMouseUp(ByVal eventArgs As MouseEventArgs) As Boolean
            ' Allow other components to process this event by not returning true.
            mouseDown = False
            Return False
        End Function

        Protected Overrides Function OnMouseDoubleClick(ByVal eventArgs As MouseEventArgs) As Boolean
            mouseDown = False
            Return True
        End Function

        Protected Overrides Function OnMouseEnter(ByVal eventArgs As MouseEventArgs) As Boolean
            ' Allow other components to process this event by not returning true.
            mouseDown = False
            Return False
        End Function

        Protected Overrides Function OnMouseHover(ByVal eventArgs As MouseEventArgs) As Boolean
            ' Allow other components to process this event by not returning true.
            mouseDown = False
            Return False
        End Function

        Protected Overrides Function OnMouseLeave() As Boolean
            ' Allow other components to process this event by not returning true.
            mouseDown = False
            Return False
        End Function

        Protected Overrides Function OnMouseWheel(ByVal eventArgs As MouseEventArgs) As Boolean
            mouseDown = False
            Return True
        End Function

        Protected Overrides Function OnMouseCaptureChanged() As Boolean
            ' Allow other components to process this event by not returning true.
            mouseDown = False
            Return False
        End Function

        Protected Overrides Function OnDragEnter(ByVal eventArgs As DragEventArgs) As Boolean
            Return True
        End Function

        Protected Overrides Function OnDragOver(ByVal eventArgs As DragEventArgs) As Boolean
            Return True
        End Function

        Protected Overrides Function OnDragLeave() As Boolean
            Return True
        End Function

        Protected Overrides Function OnDragDrop(ByVal eventArgs As DragEventArgs) As Boolean
            Return True
        End Function

        Protected Overrides Function OnGiveFeedback(ByVal gfbevent As GiveFeedbackEventArgs) As Boolean
            Return True
        End Function

        Protected Overrides Function OnQueryContinueDrag(ByVal qcdevent As QueryContinueDragEventArgs) As Boolean
            Return True
        End Function

        Protected Overrides Function OnKeyDown(ByVal eventArgs As KeyEventArgs) As Boolean
            If eventArgs.KeyCode = Keys.Delete Then
                Dim selectionService As ISelectionService = CType(serviceProvider.GetService(GetType(ISelectionService)), ISelectionService)
                If selectionService IsNot Nothing AndAlso TypeOf selectionService.PrimarySelection Is CodeActivity Then
                    Dim codeActivityComponent As CodeActivity = CType(selectionService.PrimarySelection, CodeActivity)
                    Dim parentActivity As CompositeActivity = codeActivityComponent.Parent
                    If parentActivity IsNot Nothing Then
                        parentActivity.Activities.Remove(codeActivityComponent)
                        Me.ParentView.Update()
                    End If
                    loader.RemoveActivityFromDesigner(codeActivityComponent)
                End If
            End If
            Return True
        End Function

        Protected Overrides Function OnKeyUp(ByVal eventArgs As KeyEventArgs) As Boolean
            Return True
        End Function

        Protected Overrides Function OnShowContextMenu(ByVal menuPoint As Point) As Boolean
            Return True
        End Function

#End Region

    End Class

Comentarios

Nota

En esta documentación se describen los tipos y espacios de nombres que están obsoletos.This material discusses types and namespaces that are obsolete. Para obtener más información, vea Tipos en desuso en Windows Workflow Foundation 4.5.For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

El diseñador de flujo de trabajo proporciona un patrón de diseño Strategy para crear objetos de filtro de mensajes reemplazables para administrar los eventos.The workflow designer provides a Strategy design pattern to create replaceable message filter objects to handle events.

Derive de la clase WorkflowDesignerMessageFilter para crear filtros de mensajes que pueden responder a los eventos de Workflow Designer, como operaciones de arrastre, operaciones de diseño y dibujo, y otros eventos del diseñador.Derive from the WorkflowDesignerMessageFilter class to create message filters that can respond to workflow designer events, such as drag operations, layout and paint operations, and other designer events. Para agregar un filtro de mensajes personalizado a la cadena de filtros de mensajes, llame al método AddDesignerMessageFilter en WorkflowView o invalide la propiedad virtual MessageFilters en la actividad raíz personalizada y agregue el filtro de mensajes personalizado a la colección devuelta de la clase base.To add a custom message filter to the message filters chain, call the AddDesignerMessageFilter on the WorkflowView or override the MessageFilters virtual property on the custom root activity and add the custom message filter to the collection returned from the base class.

Constructores

WorkflowDesignerMessageFilter() WorkflowDesignerMessageFilter() WorkflowDesignerMessageFilter() WorkflowDesignerMessageFilter()

Cuando se implementa en una clase derivada, inicializa una instancia de un WorkflowDesignerMessageFilter.When implemented in a derived class, initializes an instance of a WorkflowDesignerMessageFilter.

Propiedades

MessageHitTestContext MessageHitTestContext MessageHitTestContext MessageHitTestContext

Obtiene el objeto HitTestInfo que describe el contexto del WorkflowDesignerMessageFilter.Gets the HitTestInfo that describes the context of the WorkflowDesignerMessageFilter.

ParentView ParentView ParentView ParentView

Obtiene el WorkflowView asociado a WorkflowDesignerMessageFilter.Gets the WorkflowView that is associated with the WorkflowDesignerMessageFilter.

Métodos

Dispose() Dispose() Dispose() Dispose()

Libera los recursos utilizados por WorkflowDesignerMessageFilter.Releases the resources used by the WorkflowDesignerMessageFilter.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Libera los recursos no administrados que usa WorkflowDesignerMessageFilter y, de forma opcional, libera los recursos administrados.Releases the unmanaged resources used by the WorkflowDesignerMessageFilter and optionally releases the managed resources.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determina si el objeto especificado es igual al objeto actual.Determines whether the specified object is equal to the current object.

(Inherited from Object)
Finalize() Finalize() Finalize() Finalize()

Intenta liberar los recursos mediante una llamada a Dispose(false) antes de que el objeto sea reclamado por la recolección de elementos no utilizados.Attempts to free resources by calling Dispose(false) before the object is reclaimed by garbage collection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Sirve como la función hash predeterminada.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

(Inherited from Object)
Initialize(WorkflowView) Initialize(WorkflowView) Initialize(WorkflowView) Initialize(WorkflowView)

Inicializa WorkflowDesignerMessageFilter con la clase WorkflowView asociada.Initializes the WorkflowDesignerMessageFilter with the associated WorkflowView.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Crea una copia superficial del objeto Object actual.Creates a shallow copy of the current Object.

(Inherited from Object)
OnDragDrop(DragEventArgs) OnDragDrop(DragEventArgs) OnDragDrop(DragEventArgs) OnDragDrop(DragEventArgs)

Se produce cuando se suelta el botón del mouse sobre un objeto durante una operación de arrastrar.Occurs when the mouse button is released above an object during a drag operation.

OnDragEnter(DragEventArgs) OnDragEnter(DragEventArgs) OnDragEnter(DragEventArgs) OnDragEnter(DragEventArgs)

Se produce cuando el puntero del mouse se introduce dentro de los límites de un objeto durante una operación de arrastrar.Occurs when the mouse pointer enters the bounds of an object during a drag operation.

OnDragLeave() OnDragLeave() OnDragLeave() OnDragLeave()

Se produce cuando el puntero del mouse sale de los límites de un objeto durante una operación de arrastrar.Occurs when the mouse pointer leaves the bounds of an object during a drag operation.

OnDragOver(DragEventArgs) OnDragOver(DragEventArgs) OnDragOver(DragEventArgs) OnDragOver(DragEventArgs)

Se produce cuando el puntero del mouse se mueve dentro de los límites de un objeto durante una operación de arrastrar.Occurs when the mouse pointer moves within the bounds of an object during a drag operation.

OnGiveFeedback(GiveFeedbackEventArgs) OnGiveFeedback(GiveFeedbackEventArgs) OnGiveFeedback(GiveFeedbackEventArgs) OnGiveFeedback(GiveFeedbackEventArgs)

Se produce durante una operación de arrastre.Occurs during a drag operation.

OnKeyDown(KeyEventArgs) OnKeyDown(KeyEventArgs) OnKeyDown(KeyEventArgs) OnKeyDown(KeyEventArgs)

Se produce cuando se presiona una tecla.Occurs when a key is pressed.

OnKeyUp(KeyEventArgs) OnKeyUp(KeyEventArgs) OnKeyUp(KeyEventArgs) OnKeyUp(KeyEventArgs)

Tiene lugar cuando se suelta la tecla.Occurs when a key is released.

OnLayout(LayoutEventArgs) OnLayout(LayoutEventArgs) OnLayout(LayoutEventArgs) OnLayout(LayoutEventArgs)

Se produce cuando se debe cambiar la posición de los objetos secundarios.Occurs when child objects should be repositioned.

OnMouseCaptureChanged() OnMouseCaptureChanged() OnMouseCaptureChanged() OnMouseCaptureChanged()

Se produce cuando los elementos seleccionados arrastrando el mouse cambian.Occurs when the items selected by dragging the mouse changes.

OnMouseDoubleClick(MouseEventArgs) OnMouseDoubleClick(MouseEventArgs) OnMouseDoubleClick(MouseEventArgs) OnMouseDoubleClick(MouseEventArgs)

Se produce al hacer doble clic con el mouse.Occurs when you double-click the mouse.

OnMouseDown(MouseEventArgs) OnMouseDown(MouseEventArgs) OnMouseDown(MouseEventArgs) OnMouseDown(MouseEventArgs)

Se produce cuando se hace clic en un botón del mouse.Occurs when a mouse button is clicked.

OnMouseEnter(MouseEventArgs) OnMouseEnter(MouseEventArgs) OnMouseEnter(MouseEventArgs) OnMouseEnter(MouseEventArgs)

Se produce cuando el puntero del mouse entra en los límites de un objeto.Occurs when the mouse pointer enters the bounds of an object.

OnMouseHover(MouseEventArgs) OnMouseHover(MouseEventArgs) OnMouseHover(MouseEventArgs) OnMouseHover(MouseEventArgs)

Se produce cuando el puntero del mouse se desplaza sobre un objeto.Occurs when the mouse pointer pauses above an object.

OnMouseLeave() OnMouseLeave() OnMouseLeave() OnMouseLeave()

Se produce cuando el puntero del mouse sale de los límites de un objeto.Occurs when the mouse pointer leaves the bounds of an object.

OnMouseMove(MouseEventArgs) OnMouseMove(MouseEventArgs) OnMouseMove(MouseEventArgs) OnMouseMove(MouseEventArgs)

Se produce cuando el puntero del mouse se desplaza dentro de los límites de un objeto.Occurs when the mouse pointer moves while within the bounds of an object.

OnMouseUp(MouseEventArgs) OnMouseUp(MouseEventArgs) OnMouseUp(MouseEventArgs) OnMouseUp(MouseEventArgs)

Se produce cuando se suelta el botón del mouse.Occurs when the mouse button is released.

OnMouseWheel(MouseEventArgs) OnMouseWheel(MouseEventArgs) OnMouseWheel(MouseEventArgs) OnMouseWheel(MouseEventArgs)

Se produce cuando se mueve la rueda del mouse.Occurs when the mouse wheel moves.

OnPaint(PaintEventArgs, Rectangle, AmbientTheme) OnPaint(PaintEventArgs, Rectangle, AmbientTheme) OnPaint(PaintEventArgs, Rectangle, AmbientTheme) OnPaint(PaintEventArgs, Rectangle, AmbientTheme)

Se produce cuando se recibe un mensaje de dibujo.Occurs when a paint message is received.

OnPaintWorkflowAdornments(PaintEventArgs, Rectangle, AmbientTheme) OnPaintWorkflowAdornments(PaintEventArgs, Rectangle, AmbientTheme) OnPaintWorkflowAdornments(PaintEventArgs, Rectangle, AmbientTheme) OnPaintWorkflowAdornments(PaintEventArgs, Rectangle, AmbientTheme)

Se produce cuando el flujo de trabajo debe volver a dibujar sus opciones gráficas.Occurs when the workflow should repaint its adornments.

OnQueryContinueDrag(QueryContinueDragEventArgs) OnQueryContinueDrag(QueryContinueDragEventArgs) OnQueryContinueDrag(QueryContinueDragEventArgs) OnQueryContinueDrag(QueryContinueDragEventArgs)

Se produce durante una operación de arrastre.Occurs during a drag operation.

OnScroll(ScrollBar, Int32) OnScroll(ScrollBar, Int32) OnScroll(ScrollBar, Int32) OnScroll(ScrollBar, Int32)

Se produce cuando un usuario se desplaza en un diseñador del flujo de trabajo.Occurs when a user scrolls in a workflow designer.

OnShowContextMenu(Point) OnShowContextMenu(Point) OnShowContextMenu(Point) OnShowContextMenu(Point)

Se produce cuando el flujo de trabajo debe mostrar un menú contextual.Occurs when the workflow should show a context menu.

OnThemeChange() OnThemeChange() OnThemeChange() OnThemeChange()

Se produce cuando cambia el tema del flujo de trabajo.Occurs when the theme of the workflow changes.

ProcessMessage(Message) ProcessMessage(Message) ProcessMessage(Message) ProcessMessage(Message)

Se produce cuando se debe procesar un mensaje de Win32 sin formato.Occurs when a raw Win32 message must be processed.

ToString() ToString() ToString() ToString()

Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object.

(Inherited from Object)

Se aplica a

Consulte también: