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;
}