Building a workflow designer with Silverlight (vii)

Source: Internet
Author: User

Latest Source code Download: http://shareidea.net/opensource.htm

Latest Version Online Demo: http://www.shareidea.net/workflow.htm

This chapter includes two parts, one is to drag and drop the mouse automatically generated rules on the activity class, and the other is the feedback of the user, the end of the rule is not in the center of the activity, but at the edge of the activity.

Five Landscaping

5.9 using the mouse to drag and drop automatic generation rules

The content of this chapter will add a very good user experience function to the system. Before we add a set of rules requires the following several steps:

Click the Add Rule button to add a rule to the container.

Drag the starting part of the rule to associate an activity.

Drag the end of the rule to associate to an activity.

Although only need to move the mouse, has been very simple, but is there any simpler? Of course, when the mouse in the center of the active press, and drag the mouse, it will automatically generate a temporary rule, the start of this rule automatically associated with the activity just clicked, the end point of the temporary rule with the mouse movement, the process of the following figure to illustrate:

Let's take a look at what you need to do to accomplish these functions.

1. A central area of activity needs to be identified

Add a circular graph to the active XAML file, centered on the center of the rule, and for clarity, the center area is filled with yellow, with transparency set to 0.3.

2. Monitoring of MouseLeftButtonDown events in the central area

When the mouse is pressed in the center area, a temporary rule is automatically generated and the starting activity of the rule is set to the current activity, passing this rule to the global temporary rule in step three, as follows:

if (_container.CurrentTemporaryRule == nul)
{
_container.CurrentTemporaryRule = new Rule(_container);
_container.CurrentTemporaryRule.IsTemporaryRule = true;
_container.AddRule(_container.CurrentTemporaryRule);
_container.CurrentTemporaryRule.SetBeginActivity(this);
_container.CurrentTemporaryRule.EndPointPosition = _container.CurrentTemporaryRule.BeginPointPosition;
_container.CurrentTemporaryRule.ZIndex = _container.NextMaxIndex;

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.