当前位置: 首页>>代码示例>>C#>>正文


C# WorkflowView.AddDesignerMessageFilter方法代码示例

本文整理汇总了C#中System.Workflow.ComponentModel.Design.WorkflowView.AddDesignerMessageFilter方法的典型用法代码示例。如果您正苦于以下问题:C# WorkflowView.AddDesignerMessageFilter方法的具体用法?C# WorkflowView.AddDesignerMessageFilter怎么用?C# WorkflowView.AddDesignerMessageFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Workflow.ComponentModel.Design.WorkflowView的用法示例。


在下文中一共展示了WorkflowView.AddDesignerMessageFilter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WorkflowViewWrapper

public WorkflowViewWrapper()
{
    this.loader = new Loader();

    // Create a Workflow Design Surface
    this.surface = new DesignSurface();
    this.surface.BeginLoad(this.loader);

    // Get the Workflow Designer Host
    this.Host = this.surface.GetService(typeof(IDesignerHost)) as IDesignerHost;

    if (this.Host == null)
        return;

    // Create a Sequential Workflow by using the Workflow Designer Host
    SequentialWorkflow = (SequentialWorkflowActivity)Host.CreateComponent(typeof(SequentialWorkflowActivity));
    SequentialWorkflow.Name = "CustomOutlookWorkflow";

    // Create a Workflow View on the Workflow Design Surface
    this.workflowView = new WorkflowView(this.surface as IServiceProvider);

    // Add a message filter to the workflow view, to support panning
    MessageFilter filter = new MessageFilter(this.surface as IServiceProvider, this.workflowView);
    this.workflowView.AddDesignerMessageFilter(filter);

    // Activate the Workflow View
    this.Host.Activate();

    this.workflowView.Dock = DockStyle.Fill;
    this.Controls.Add(workflowView);
    this.Dock = DockStyle.Fill;
}
开发者ID:.NET开发者,项目名称:System.Workflow.ComponentModel.Design,代码行数:32,代码来源:WorkflowView.AddDesignerMessageFilter

示例2: MessageFilter

internal sealed class MessageFilter : WorkflowDesignerMessageFilter
{
    private bool mouseDown;
    private IServiceProvider serviceProvider;
    private WorkflowView workflowView;

    public MessageFilter(IServiceProvider provider, WorkflowView view)
    {
        this.serviceProvider = provider;
        this.workflowView = view;
    }

    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 (this.mouseDown)
        {
            this.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.
        this.mouseDown = false;
        return false;
    }

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

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

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

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

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

    protected override bool OnMouseCaptureChanged()
    {
        // Allow other components to process this event by not returning true.
        this.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 OnKeyUp(KeyEventArgs eventArgs)
    {
        return true;
    }

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

    protected override bool OnKeyDown(KeyEventArgs eventArgs)
    {
        if (eventArgs.KeyCode == Keys.Delete)
        {
            ISelectionService selectionService = (ISelectionService)this.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();
                }
            }
        }
        return true;
    }
}
开发者ID:.NET开发者,项目名称:System.Workflow.ComponentModel.Design,代码行数:133,代码来源:WorkflowView.AddDesignerMessageFilter


注:本文中的System.Workflow.ComponentModel.Design.WorkflowView.AddDesignerMessageFilter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。