當前位置: 首頁>>代碼示例>>C#>>正文


C# WorkflowDesignerMessageFilter類代碼示例

本文整理匯總了C#中System.Workflow.ComponentModel.Design.WorkflowDesignerMessageFilter的典型用法代碼示例。如果您正苦於以下問題:C# WorkflowDesignerMessageFilter類的具體用法?C# WorkflowDesignerMessageFilter怎麽用?C# WorkflowDesignerMessageFilter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WorkflowDesignerMessageFilter類屬於System.Workflow.ComponentModel.Design命名空間,在下文中一共展示了WorkflowDesignerMessageFilter類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CustomMessageFilter

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
}
開發者ID:.NET開發者,項目名稱:System.Workflow.ComponentModel.Design,代碼行數:146,代碼來源:WorkflowDesignerMessageFilter


注:本文中的System.Workflow.ComponentModel.Design.WorkflowDesignerMessageFilter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。