You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@@ -0,0 +1,97 @@
|
||||
#region Using Directives
|
||||
using System;
|
||||
using System.Resources;
|
||||
using System.Drawing;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
#endregion
|
||||
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
#region Class ActivityDesignerResources (DR)
|
||||
internal static class DR
|
||||
{
|
||||
internal static Color TransparentColor = Color.FromArgb(255, 0, 255);
|
||||
internal const string ResourceSet = "System.Workflow.Activities.ActivityDesignerResources";
|
||||
private static ResourceManager resourceManager = new ResourceManager(ResourceSet, System.Reflection.Assembly.GetExecutingAssembly());
|
||||
|
||||
internal const string DropActivityHere = "DropActivityHere";
|
||||
internal const string MoveLeftDesc = "MoveLeftDesc";
|
||||
internal const string MoveRightDesc = "MoveRightDesc";
|
||||
internal const string DropEventsHere = "DropEventsHere";
|
||||
internal const string InvokeWebServiceDisplayName = "InvokeWebServiceDisplayName";
|
||||
internal const string ScopeDesc = "ScopeDesc";
|
||||
internal const string EventsDesc = "EventsDesc";
|
||||
internal const string SequentialWorkflowHelpText = "SequentialWorkflowHelpText";
|
||||
internal const string StartSequentialWorkflow = "StartSequentialWorkflow";
|
||||
internal const string WorkflowExceptions = "WorkflowExceptions";
|
||||
internal const string WorkflowEvents = "WorkflowEvents";
|
||||
internal const string WorkflowCompensation = "WorkflowCompensation";
|
||||
internal const string WorkflowCancellation = "WorkflowCancellation";
|
||||
internal const string EventBasedWorkFlow = "EventBasedWorkFlow";
|
||||
internal const string AddNewEvent = "AddNewEvent";
|
||||
internal const string DeleteEvent = "DeleteEvent";
|
||||
internal const string ViewPreviousEvent = "ViewPreviousEvent";
|
||||
internal const string ViewNextEvent = "ViewNextEvent";
|
||||
internal const string NavigateToEvent = "NavigateToEvent";
|
||||
internal const string View = "View";
|
||||
internal const string AddNewEventDesc = "AddNewEventDesc";
|
||||
internal const string DeleteEventDesc = "DeleteEventDesc";
|
||||
internal const string NavigateToEventDesc = "NavigateToEventDesc";
|
||||
internal const string ViewPreviousEventDesc = "ViewPreviousEventDesc";
|
||||
internal const string ViewNextEventDesc = "ViewNextEventDesc";
|
||||
internal const string WebServiceReceiveDisplayName = "WebServiceReceiveDisplayName";
|
||||
internal const string WebServiceResponseDisplayName = "WebServiceResponseDisplayName";
|
||||
internal const string WebServiceFaultDisplayName = "WebServiceFaultDisplayName";
|
||||
internal const string AddState = "AddState";
|
||||
internal const string AddEventDriven = "AddEventDriven";
|
||||
internal const string AddStateInitialization = "AddStateInitialization";
|
||||
internal const string AddStateFinalization = "AddStateFinalization";
|
||||
internal const string AddingChild = "AddingChild";
|
||||
internal const string StateHelpText = "StateHelpText";
|
||||
internal const string StateMachineWorkflowHelpText = "StateMachineWorkflowHelpText";
|
||||
internal const string StateMachineView = "StateMachineView";
|
||||
internal const string SetAsInitialState = "SetAsInitialState";
|
||||
internal const string SetAsCompletedState = "SetAsCompletedState";
|
||||
internal const string SendToBack = "SendToBack";
|
||||
internal const string BringToFront = "BringToFront";
|
||||
internal const string ImageFileFilter = "ImageFileFilter";
|
||||
|
||||
//Bitmaps
|
||||
internal const string Compensation = "Compensation";
|
||||
internal const string SequenceArrow = "SequenceArrow";
|
||||
internal const string Event = "Event";
|
||||
internal const string Exception = "Exception";
|
||||
internal const string NewEvent = "NewEvent";
|
||||
internal const string Delete = "Delete";
|
||||
internal const string NextEvent = "NextEvent";
|
||||
internal const string PreviousEvent = "PreviousEvent";
|
||||
internal const string NavigateEvent = "NavigateEvent";
|
||||
internal const string WorkflowView = "WorkflowView";
|
||||
internal const string ExceptionsView = "ExceptionsView";
|
||||
internal const string EventsView = "EventsView";
|
||||
internal const string CompensationView = "CompensationView";
|
||||
internal const string InitialState = "InitialState";
|
||||
internal const string CompletedState = "CompletedState";
|
||||
internal const string ThemePropertyReadOnly = "ThemePropertyReadOnly";
|
||||
internal const string Error_InvalidImageResource = "Error_InvalidImageResource";
|
||||
|
||||
internal static string GetString(string resID)
|
||||
{
|
||||
return DR.resourceManager.GetString(resID);
|
||||
}
|
||||
|
||||
internal static Image GetImage(string resID)
|
||||
{
|
||||
Image image = DR.resourceManager.GetObject(resID) as Image;
|
||||
|
||||
//Please note that the default version of make transparent uses the color of pixel at left bottom of the image
|
||||
//as the transparent color to make the bitmap transparent. Hence we do not use it
|
||||
Bitmap bitmap = image as Bitmap;
|
||||
if (bitmap != null)
|
||||
bitmap.MakeTransparent(DR.TransparentColor);
|
||||
|
||||
return image;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.Design;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Xml;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
using System.ComponentModel.Design.Serialization;
|
||||
|
||||
[ActivityDesignerTheme(typeof(ConditionedActivityGroupDesignerTheme))]
|
||||
internal sealed class ConditionedActivityGroupDesigner : ActivityPreviewDesigner
|
||||
{
|
||||
#region Members, Constructor and Destructor
|
||||
|
||||
protected override void Initialize(Activity activity)
|
||||
{
|
||||
base.Initialize(activity);
|
||||
|
||||
IExtenderListService extenderListService = (IExtenderListService)GetService(typeof(IExtenderListService));
|
||||
if (extenderListService != null)
|
||||
{
|
||||
bool foundCAGExtender = false;
|
||||
foreach (IExtenderProvider extenderProvider in extenderListService.GetExtenderProviders())
|
||||
{
|
||||
if (extenderProvider.GetType() == typeof(ConditionPropertyProviderExtender))
|
||||
foundCAGExtender = true;
|
||||
}
|
||||
|
||||
if (!foundCAGExtender)
|
||||
{
|
||||
IExtenderProviderService extenderProviderService = (IExtenderProviderService)GetService(typeof(IExtenderProviderService));
|
||||
if (extenderProviderService != null)
|
||||
{
|
||||
extenderProviderService.AddExtenderProvider(new ConditionPropertyProviderExtender());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region ConditionedActivityGroupDesignerTheme
|
||||
internal sealed class ConditionedActivityGroupDesignerTheme : ActivityPreviewDesignerTheme
|
||||
{
|
||||
public ConditionedActivityGroupDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.ShowDropShadow = false;
|
||||
this.ConnectorStartCap = LineAnchor.None;
|
||||
this.ConnectorEndCap = LineAnchor.None;
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0x6B, 0x6D, 0x6B);
|
||||
this.BorderStyle = DashStyle.Solid;
|
||||
this.BackColorStart = Color.FromArgb(0xFF, 0xEF, 0xEF, 0xEF);
|
||||
this.BackColorEnd = Color.FromArgb(0xFF, 0xEF, 0xEF, 0xEF);
|
||||
this.PreviewForeColor = Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0);
|
||||
this.PreviewBorderColor = Color.FromArgb(0xFF, 0x6B, 0x6D, 0x6B);
|
||||
this.PreviewBackColor = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Class ConditionPropertyProviderExtender
|
||||
[ProvideProperty("WhenCondition", typeof(Activity))]
|
||||
[ProvideProperty("UnlessCondition", typeof(Activity))]
|
||||
internal sealed class ConditionPropertyProviderExtender : IExtenderProvider
|
||||
{
|
||||
internal ConditionPropertyProviderExtender()
|
||||
{
|
||||
}
|
||||
|
||||
[SRCategory(SR.ConditionedActivityConditions)]
|
||||
[SRDescription(SR.WhenConditionDescr)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public ActivityCondition GetWhenCondition(Activity activity)
|
||||
{
|
||||
if (activity.Parent is ConditionedActivityGroup)
|
||||
return activity.GetValue(ConditionedActivityGroup.WhenConditionProperty) as ActivityCondition;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
[SRCategory(SR.ConditionedActivityConditions)]
|
||||
[SRDescription(SR.WhenConditionDescr)]
|
||||
public void SetWhenCondition(Activity activity, ActivityCondition handler)
|
||||
{
|
||||
if (activity.Parent is ConditionedActivityGroup)
|
||||
activity.SetValue(ConditionedActivityGroup.WhenConditionProperty, handler);
|
||||
}
|
||||
|
||||
#region IExtenderProvider Members
|
||||
public bool CanExtend(object extendee)
|
||||
{
|
||||
return ((extendee != this) && (extendee is Activity) && (((Activity)extendee).Parent is ConditionedActivityGroup));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.CodeDom;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
|
||||
#region Class CodeDesigner
|
||||
[ActivityDesignerTheme(typeof(CodeDesignerTheme))]
|
||||
internal sealed class CodeDesigner : ActivityDesigner
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region CodeDesignerTheme
|
||||
internal sealed class CodeDesignerTheme : ActivityDesignerTheme
|
||||
{
|
||||
public CodeDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0x80, 0x80, 0x80);
|
||||
this.BorderStyle = DashStyle.Solid;
|
||||
this.BackColorStart = Color.FromArgb(0xFF, 0xF4, 0xF4, 0xF4);
|
||||
this.BackColorEnd = Color.FromArgb(0xFF, 0xC0, 0xC0, 0xC0);
|
||||
this.BackgroundStyle = LinearGradientMode.Horizontal;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.CodeDom;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Design;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Diagnostics;
|
||||
|
||||
#region Class ConditionalToolboxItem
|
||||
[Serializable]
|
||||
internal sealed class IfElseToolboxItem : ActivityToolboxItem
|
||||
{
|
||||
public IfElseToolboxItem(Type type)
|
||||
: base(type)
|
||||
{
|
||||
}
|
||||
private IfElseToolboxItem(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
Deserialize(info, context);
|
||||
}
|
||||
protected override IComponent[] CreateComponentsCore(IDesignerHost designerHost)
|
||||
{
|
||||
CompositeActivity conditionalActivity = new IfElseActivity();
|
||||
conditionalActivity.Activities.Add(new IfElseBranchActivity());
|
||||
conditionalActivity.Activities.Add(new IfElseBranchActivity());
|
||||
return (IComponent[])new IComponent[] { conditionalActivity };
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Class ConditionalDesigner
|
||||
[ActivityDesignerTheme(typeof(IfElseDesignerTheme))]
|
||||
internal sealed class IfElseDesigner : ParallelActivityDesigner
|
||||
{
|
||||
#region Properties and Methods
|
||||
public override bool CanInsertActivities(HitTestInfo insertLocation, ReadOnlyCollection<Activity> activitiesToInsert)
|
||||
{
|
||||
foreach (Activity activity in activitiesToInsert)
|
||||
{
|
||||
if (!(activity is IfElseBranchActivity))
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CanInsertActivities(insertLocation, activitiesToInsert);
|
||||
}
|
||||
|
||||
public override bool CanRemoveActivities(ReadOnlyCollection<Activity> activitiesToRemove)
|
||||
{
|
||||
if ((ContainedDesigners.Count - activitiesToRemove.Count) < 1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool CanMoveActivities(HitTestInfo moveLocation, ReadOnlyCollection<Activity> activitiesToMove)
|
||||
{
|
||||
if ((ContainedDesigners.Count - activitiesToMove.Count) < 1)
|
||||
{
|
||||
if (moveLocation != null && moveLocation.AssociatedDesigner != this)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override CompositeActivity OnCreateNewBranch()
|
||||
{
|
||||
return new IfElseBranchActivity();
|
||||
}
|
||||
|
||||
protected override void OnPaint(ActivityDesignerPaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
if (!Expanded || ContainedDesigners.Count == 0 || this != ActiveView.AssociatedDesigner)
|
||||
return;
|
||||
|
||||
CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;
|
||||
Debug.Assert(compositeDesignerTheme != null);
|
||||
if (compositeDesignerTheme == null)
|
||||
return;
|
||||
|
||||
//Draw the Icon and Text
|
||||
Rectangle bounds = Bounds;
|
||||
Rectangle imageRectangle = ImageRectangle;
|
||||
|
||||
Rectangle diamondRectangle = Rectangle.Empty;
|
||||
diamondRectangle.Width = compositeDesignerTheme.ConnectorSize.Height - 2 * e.AmbientTheme.Margin.Height + 2;
|
||||
diamondRectangle.Height = diamondRectangle.Width;
|
||||
diamondRectangle.X = bounds.Left + bounds.Width / 2 - diamondRectangle.Width / 2;
|
||||
diamondRectangle.Y = bounds.Top + TitleHeight + (compositeDesignerTheme.ConnectorSize.Height * 3 / 2 - diamondRectangle.Height) / 2 + 1;
|
||||
|
||||
using (GraphicsPath decisionDiamond = GetDiamondPath(diamondRectangle))
|
||||
{
|
||||
e.Graphics.FillPath(compositeDesignerTheme.ForegroundBrush, decisionDiamond);
|
||||
e.Graphics.DrawPath(compositeDesignerTheme.ForegroundPen, decisionDiamond);
|
||||
}
|
||||
|
||||
diamondRectangle.Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height * 3 / 2 + (compositeDesignerTheme.ConnectorSize.Height * 3 / 2 - diamondRectangle.Height) / 2 + 1;
|
||||
using (GraphicsPath decisionDiamond = GetDiamondPath(diamondRectangle))
|
||||
{
|
||||
e.Graphics.FillPath(compositeDesignerTheme.ForegroundBrush, decisionDiamond);
|
||||
e.Graphics.DrawPath(compositeDesignerTheme.ForegroundPen, decisionDiamond);
|
||||
}
|
||||
}
|
||||
|
||||
private GraphicsPath GetDiamondPath(Rectangle rectangle)
|
||||
{
|
||||
Point[] diamondPoints =
|
||||
{
|
||||
new Point(rectangle.Left + rectangle.Width / 2, rectangle.Top),
|
||||
new Point(rectangle.Right - 1, rectangle.Top + rectangle.Height / 2),
|
||||
new Point(rectangle.Left + rectangle.Width / 2, rectangle.Bottom - 1),
|
||||
new Point(rectangle.Left, rectangle.Top + rectangle.Height / 2),
|
||||
new Point(rectangle.Left + rectangle.Width / 2, rectangle.Top)
|
||||
};
|
||||
|
||||
GraphicsPath diamondPath = new GraphicsPath();
|
||||
diamondPath.AddLines(diamondPoints);
|
||||
diamondPath.CloseFigure();
|
||||
return diamondPath;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IfElseDesignerTheme
|
||||
internal sealed class IfElseDesignerTheme : CompositeDesignerTheme
|
||||
{
|
||||
public IfElseDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.ShowDropShadow = false;
|
||||
this.ConnectorStartCap = LineAnchor.None;
|
||||
this.ConnectorEndCap = LineAnchor.None;
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x00, 0x64, 0x00);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0xE0, 0xE0, 0xE0);
|
||||
this.BorderStyle = DashStyle.Dash;
|
||||
this.BackColorStart = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
this.BackColorEnd = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.CodeDom;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
|
||||
#region Class ConditionedDesigner
|
||||
[ActivityDesignerTheme(typeof(ConditionedDesignerTheme))]
|
||||
internal sealed class IfElseBranchDesigner : SequentialActivityDesigner
|
||||
{
|
||||
#region Properties and Methods
|
||||
public override bool CanBeParentedTo(CompositeActivityDesigner parentActivityDesigner)
|
||||
{
|
||||
if (parentActivityDesigner == null)
|
||||
throw new ArgumentNullException("parentActivity");
|
||||
|
||||
if (!(parentActivityDesigner.Activity is IfElseActivity))
|
||||
return false;
|
||||
|
||||
return base.CanBeParentedTo(parentActivityDesigner);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ConditionedDesignerTheme
|
||||
internal sealed class ConditionedDesignerTheme : CompositeDesignerTheme
|
||||
{
|
||||
public ConditionedDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.ShowDropShadow = false;
|
||||
this.ConnectorStartCap = LineAnchor.None;
|
||||
this.ConnectorEndCap = LineAnchor.ArrowAnchor;
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x00, 0x64, 0x00);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0xE0, 0xE0, 0xE0);
|
||||
this.BorderStyle = DashStyle.Dash;
|
||||
this.BackColorStart = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
this.BackColorEnd = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.CodeDom;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
|
||||
#region Class DelayDesigner
|
||||
[ActivityDesignerTheme(typeof(DelayDesignerTheme))]
|
||||
internal sealed class DelayDesigner : ActivityDesigner
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DelayDesignerTheme
|
||||
internal sealed class DelayDesignerTheme : ActivityDesignerTheme
|
||||
{
|
||||
public DelayDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0x80, 0x40, 0x40);
|
||||
this.BorderStyle = DashStyle.Solid;
|
||||
this.BackColorStart = Color.FromArgb(0xFF, 0x80, 0x40, 0x40);
|
||||
this.BackColorEnd = Color.FromArgb(0xFF, 0xF1, 0xE4, 0xE4);
|
||||
this.BackgroundStyle = LinearGradientMode.Horizontal;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.CodeDom;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
using System.Workflow.Activities.Common;
|
||||
|
||||
#region EventDrivenDesigner
|
||||
[ActivityDesignerTheme(typeof(EventDrivenDesignerTheme))]
|
||||
internal sealed class EventDrivenDesigner : SequenceDesigner
|
||||
{
|
||||
#region Properties and Methods
|
||||
public override bool CanBeParentedTo(CompositeActivityDesigner parentActivityDesigner)
|
||||
{
|
||||
if (parentActivityDesigner == null)
|
||||
throw new ArgumentNullException("parentActivity");
|
||||
|
||||
if (!(Type.GetType("System.Workflow.Activities.ListenActivity," + AssemblyRef.ActivitiesAssemblyRef).IsAssignableFrom(parentActivityDesigner.Activity.GetType())) &&
|
||||
!(parentActivityDesigner.Activity is EventHandlersActivity) &&
|
||||
!(Type.GetType("System.Workflow.Activities.StateActivity," + AssemblyRef.ActivitiesAssemblyRef).IsAssignableFrom(parentActivityDesigner.Activity.GetType())))
|
||||
return false;
|
||||
|
||||
return base.CanBeParentedTo(parentActivityDesigner);
|
||||
}
|
||||
|
||||
protected override void DoDefaultAction()
|
||||
{
|
||||
base.DoDefaultAction();
|
||||
EnsureVisible();
|
||||
}
|
||||
|
||||
public override bool CanExpandCollapse
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ParentDesigner is System.Workflow.Activities.StateDesigner)
|
||||
return false;
|
||||
return base.CanExpandCollapse;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region EventDrivenDesignerTheme
|
||||
internal sealed class EventDrivenDesignerTheme : CompositeDesignerTheme
|
||||
{
|
||||
public EventDrivenDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.ShowDropShadow = false;
|
||||
this.ConnectorStartCap = LineAnchor.None;
|
||||
this.ConnectorEndCap = LineAnchor.ArrowAnchor;
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x80, 0x00, 0x00);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0xE0, 0xE0, 0xE0);
|
||||
this.BorderStyle = DashStyle.Dash;
|
||||
this.BackColorStart = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
this.BackColorEnd = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Collections;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
|
||||
#region Class EventHandlersDesigner
|
||||
[ActivityDesignerTheme(typeof(EventHandlersDesignerTheme))]
|
||||
internal sealed class EventHandlersDesigner : ActivityPreviewDesigner
|
||||
{
|
||||
#region Members, Constructor and Destructor
|
||||
protected override void Initialize(Activity activity)
|
||||
{
|
||||
base.Initialize(activity);
|
||||
|
||||
HelpText = DR.GetString(DR.DropEventsHere);
|
||||
ShowPreview = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties and Methods
|
||||
public override bool CanExpandCollapse
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanBeParentedTo(CompositeActivityDesigner parentActivityDesigner)
|
||||
{
|
||||
if (parentActivityDesigner == null)
|
||||
throw new ArgumentNullException("parentActivity");
|
||||
|
||||
if (parentActivityDesigner.Activity != null)
|
||||
{
|
||||
if (!(parentActivityDesigner.Activity is EventHandlingScopeActivity))
|
||||
return false;
|
||||
}
|
||||
return base.CanBeParentedTo(parentActivityDesigner);
|
||||
}
|
||||
|
||||
public override bool CanInsertActivities(HitTestInfo insertLocation, ReadOnlyCollection<Activity> activitiesToInsert)
|
||||
{
|
||||
foreach (Activity activity in activitiesToInsert)
|
||||
{
|
||||
if (!(activity is EventDrivenActivity))
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CanInsertActivities(insertLocation, activitiesToInsert);
|
||||
}
|
||||
|
||||
public override object FirstSelectableObject
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Expanded && IsVisible)
|
||||
{
|
||||
if (PreviewedDesigner != null || ContainedDesigners.Count > 0)
|
||||
return base.FirstSelectableObject;
|
||||
else if (ContainedDesigners.Count == 0)
|
||||
return new ConnectorHitTestInfo(this, HitTestLocations.Designer, 0).SelectableObject;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public override object LastSelectableObject
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Expanded && IsVisible)
|
||||
{
|
||||
if (PreviewedDesigner != null || ContainedDesigners.Count > 0)
|
||||
return base.LastSelectableObject;
|
||||
else if (ContainedDesigners.Count == 0)
|
||||
return new ConnectorHitTestInfo(this, HitTestLocations.Designer, GetConnectors().GetLength(0) - 1).SelectableObject;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region EventHandlersDesignerTheme
|
||||
internal sealed class EventHandlersDesignerTheme : ActivityPreviewDesignerTheme
|
||||
{
|
||||
public EventHandlersDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.ShowDropShadow = false;
|
||||
this.ConnectorStartCap = LineAnchor.None;
|
||||
this.ConnectorEndCap = LineAnchor.None;
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0xE0, 0xE0, 0xE0);
|
||||
this.BorderStyle = DashStyle.Dash;
|
||||
this.BackColorStart = Color.FromArgb(0x35, 0xFF, 0xFF, 0xB0);
|
||||
this.BackColorEnd = Color.FromArgb(0x35, 0xFF, 0xFF, 0xB0);
|
||||
this.PreviewForeColor = Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0);
|
||||
this.PreviewBorderColor = Color.FromArgb(0xFF, 0x6B, 0x6D, 0x6B);
|
||||
this.PreviewBackColor = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.CodeDom;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
using System.Workflow.ComponentModel.Compiler;
|
||||
using System.Workflow.Activities.Common;
|
||||
|
||||
#region Class HandleExternalEventActivityDesigner
|
||||
[ActivityDesignerTheme(typeof(EventSinkDesignerTheme))]
|
||||
internal class HandleExternalEventActivityDesigner : ActivityDesigner
|
||||
{
|
||||
protected override void PreFilterProperties(IDictionary properties)
|
||||
{
|
||||
base.PreFilterProperties(properties);
|
||||
|
||||
object corrRefProperty = properties["CorrelationToken"];
|
||||
|
||||
HandleExternalEventActivity eventSink = Activity as HandleExternalEventActivity;
|
||||
|
||||
AddRemoveCorrelationToken(eventSink.InterfaceType, properties, corrRefProperty);
|
||||
|
||||
Type type = eventSink.InterfaceType;
|
||||
if (type == null)
|
||||
return;
|
||||
|
||||
AddRemoveCorrelationToken(type, properties, corrRefProperty);
|
||||
|
||||
eventSink.GetParameterPropertyDescriptors(properties);
|
||||
}
|
||||
|
||||
private void AddRemoveCorrelationToken(Type interfaceType, IDictionary properties, object corrRefProperty)
|
||||
{
|
||||
if (interfaceType != null)
|
||||
{
|
||||
object[] corrProvAttribs = interfaceType.GetCustomAttributes(typeof(CorrelationProviderAttribute), false);
|
||||
object[] corrParamAttribs = interfaceType.GetCustomAttributes(typeof(CorrelationParameterAttribute), false);
|
||||
if (corrProvAttribs.Length != 0 || corrParamAttribs.Length != 0)
|
||||
{
|
||||
if (!properties.Contains("CorrelationToken"))
|
||||
properties.Add("CorrelationToken", corrRefProperty);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (properties.Contains("CorrelationToken"))
|
||||
properties.Remove("CorrelationToken");
|
||||
}
|
||||
|
||||
protected override void OnActivityChanged(ActivityChangedEventArgs e)
|
||||
{
|
||||
base.OnActivityChanged(e);
|
||||
|
||||
if (e.Member != null)
|
||||
{
|
||||
if (e.Member.Name == "InterfaceType")
|
||||
{
|
||||
if (Activity.Site != null)
|
||||
{
|
||||
Type interfaceType = e.NewValue as Type;
|
||||
if (interfaceType != null)
|
||||
new ExternalDataExchangeInterfaceTypeFilterProvider(Activity.Site).CanFilterType(interfaceType, true);
|
||||
|
||||
HandleExternalEventActivity eventSinkActivity = e.Activity as HandleExternalEventActivity;
|
||||
PropertyDescriptorUtils.SetPropertyValue(Activity.Site, TypeDescriptor.GetProperties(Activity)["EventName"], Activity, String.Empty);
|
||||
|
||||
IExtendedUIService extUIService = (IExtendedUIService)Activity.Site.GetService(typeof(IExtendedUIService));
|
||||
if (extUIService == null)
|
||||
throw new Exception(SR.GetString(SR.General_MissingService, typeof(IExtendedUIService).FullName));
|
||||
}
|
||||
}
|
||||
else if ((e.Member.Name == "EventName")
|
||||
&& e.Activity is HandleExternalEventActivity)
|
||||
{
|
||||
(e.Activity as HandleExternalEventActivity).ParameterBindings.Clear();
|
||||
}
|
||||
|
||||
if (e.Member.Name == "InterfaceType" || e.Member.Name == "EventName" || e.Member.Name == "CorrelationToken")
|
||||
TypeDescriptor.Refresh(e.Activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region EventSinkDesignerTheme
|
||||
internal sealed class EventSinkDesignerTheme : ActivityDesignerTheme
|
||||
{
|
||||
public EventSinkDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0x9C, 0xAE, 0x73);
|
||||
this.BorderStyle = DashStyle.Solid;
|
||||
this.BackColorStart = Color.FromArgb(0xFF, 0xF5, 0xFB, 0xE1);
|
||||
this.BackColorEnd = Color.FromArgb(0xFF, 0xD6, 0xEB, 0x84);
|
||||
this.BackgroundStyle = LinearGradientMode.Horizontal;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.CodeDom;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
using System.Workflow.ComponentModel.Compiler;
|
||||
using System.Workflow.Activities.Common;
|
||||
|
||||
#region Class CallExternalMethodActivityDesigner
|
||||
[ActivityDesignerTheme(typeof(InvokeMethodDesignerTheme))]
|
||||
internal class CallExternalMethodActivityDesigner : ActivityDesigner
|
||||
{
|
||||
protected override void PreFilterProperties(IDictionary properties)
|
||||
{
|
||||
base.PreFilterProperties(properties);
|
||||
|
||||
CallExternalMethodActivity invokeMethod = Activity as CallExternalMethodActivity;
|
||||
|
||||
object corrRefProperty = properties["CorrelationToken"];
|
||||
AddRemoveCorrelationToken(invokeMethod.InterfaceType, properties, corrRefProperty);
|
||||
|
||||
Type type = invokeMethod.InterfaceType;
|
||||
if (type == null)
|
||||
return;
|
||||
|
||||
AddRemoveCorrelationToken(type, properties, corrRefProperty);
|
||||
|
||||
invokeMethod.GetParameterPropertyDescriptors(properties);
|
||||
}
|
||||
|
||||
private void AddRemoveCorrelationToken(Type interfaceType, IDictionary properties, object corrRefProperty)
|
||||
{
|
||||
if (interfaceType != null)
|
||||
{
|
||||
object[] corrProvAttribs = interfaceType.GetCustomAttributes(typeof(CorrelationProviderAttribute), false);
|
||||
object[] corrParamAttribs = interfaceType.GetCustomAttributes(typeof(CorrelationParameterAttribute), false);
|
||||
if (corrProvAttribs.Length != 0 || corrParamAttribs.Length != 0)
|
||||
{
|
||||
if (!properties.Contains("CorrelationToken"))
|
||||
properties.Add("CorrelationToken", corrRefProperty);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (properties.Contains("CorrelationToken"))
|
||||
properties.Remove("CorrelationToken");
|
||||
}
|
||||
|
||||
protected override void OnActivityChanged(ActivityChangedEventArgs e)
|
||||
{
|
||||
base.OnActivityChanged(e);
|
||||
|
||||
if (e.Member != null)
|
||||
{
|
||||
if (e.Member.Name == "InterfaceType")
|
||||
{
|
||||
if (Activity.Site != null)
|
||||
{
|
||||
Type interfaceType = e.NewValue as Type;
|
||||
if (interfaceType != null)
|
||||
new ExternalDataExchangeInterfaceTypeFilterProvider(Activity.Site).CanFilterType(interfaceType, true);
|
||||
|
||||
CallExternalMethodActivity invokeActivity = e.Activity as CallExternalMethodActivity;
|
||||
PropertyDescriptorUtils.SetPropertyValue(Activity.Site, TypeDescriptor.GetProperties(Activity)["MethodName"], Activity, String.Empty);
|
||||
|
||||
IExtendedUIService extUIService = (IExtendedUIService)Activity.Site.GetService(typeof(IExtendedUIService));
|
||||
if (extUIService == null)
|
||||
throw new Exception(SR.GetString(SR.General_MissingService, typeof(IExtendedUIService).FullName));
|
||||
}
|
||||
}
|
||||
|
||||
if ((e.Member.Name == "MethodName")
|
||||
&& e.Activity is CallExternalMethodActivity)
|
||||
(e.Activity as CallExternalMethodActivity).ParameterBindings.Clear();
|
||||
|
||||
if (e.Member.Name == "InterfaceType" || e.Member.Name == "MethodName" || e.Member.Name == "CorrelationToken")
|
||||
TypeDescriptor.Refresh(e.Activity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region InvokeMethodDesignerTheme
|
||||
internal sealed class InvokeMethodDesignerTheme : ActivityDesignerTheme
|
||||
{
|
||||
public InvokeMethodDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0x73, 0x79, 0xA5);
|
||||
this.BorderStyle = DashStyle.Solid;
|
||||
this.BackColorStart = Color.FromArgb(0xFF, 0xDF, 0xE8, 0xFF);
|
||||
this.BackColorEnd = Color.FromArgb(0xFF, 0x95, 0xB3, 0xFF);
|
||||
this.BackgroundStyle = LinearGradientMode.Horizontal;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.CodeDom;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing.Design;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Workflow.ComponentModel.Compiler;
|
||||
using System.ComponentModel.Design.Serialization;
|
||||
using System.Collections.Specialized;
|
||||
using System.Xml;
|
||||
using System.Web.Services.Protocols;
|
||||
using System.Windows.Forms.Design;
|
||||
using System.Security.Permissions;
|
||||
using System.Workflow.Activities.Common;
|
||||
|
||||
#region Class InvokeWebServiceToolboxItem
|
||||
[Serializable]
|
||||
internal sealed class InvokeWebServiceToolboxItem : ActivityToolboxItem
|
||||
{
|
||||
public InvokeWebServiceToolboxItem(Type type)
|
||||
: base(type)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private InvokeWebServiceToolboxItem(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
base.Deserialize(info, context);
|
||||
}
|
||||
|
||||
public override IComponent[] CreateComponentsWithUI(IDesignerHost host)
|
||||
{
|
||||
Uri url = null;
|
||||
Type proxyClass = null;
|
||||
IExtendedUIService extUIService = host.GetService(typeof(IExtendedUIService)) as IExtendedUIService;
|
||||
if (extUIService != null)
|
||||
extUIService.AddWebReference(out url, out proxyClass);
|
||||
|
||||
IComponent[] components = base.CreateComponentsWithUI(host);
|
||||
if (components.GetLength(0) > 0)
|
||||
{
|
||||
InvokeWebServiceActivity webService = components[0] as InvokeWebServiceActivity;
|
||||
if (webService != null)
|
||||
webService.ProxyClass = proxyClass;
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Class InvokeWebServiceDesigner
|
||||
[ActivityDesignerTheme(typeof(InvokeWebServiceDesignerTheme))]
|
||||
internal sealed class InvokeWebServiceDesigner : ActivityDesigner
|
||||
{
|
||||
#region Members, Constructor and Destructor
|
||||
private string url = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties and Methods
|
||||
protected override void PreFilterProperties(IDictionary properties)
|
||||
{
|
||||
base.PreFilterProperties(properties);
|
||||
if (properties["URL"] == null)
|
||||
properties["URL"] = new WebServiceUrlPropertyDescriptor(Activity.Site, TypeDescriptor.CreateProperty(this.GetType(), "URL", typeof(string), DesignOnlyAttribute.Yes, MergablePropertyAttribute.No));
|
||||
|
||||
//
|
||||
|
||||
ITypeProvider typeProvider = (ITypeProvider)GetService(typeof(ITypeProvider));
|
||||
if (typeProvider == null)
|
||||
throw new InvalidOperationException(SR.GetString(SR.General_MissingService, typeof(ITypeProvider).FullName));
|
||||
|
||||
InvokeWebServiceActivity invokeWebService = Activity as InvokeWebServiceActivity;
|
||||
invokeWebService.GetParameterPropertyDescriptors(properties);
|
||||
}
|
||||
|
||||
[SRCategory(SR.Activity)]
|
||||
[SRDescription(SR.URLDescr)]
|
||||
[Editor(typeof(WebServicePickerEditor), typeof(UITypeEditor))]
|
||||
[RefreshProperties(RefreshProperties.All)]
|
||||
public string URL
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.url == null)
|
||||
{
|
||||
InvokeWebServiceActivity invokeWebServiceDecl = Activity as InvokeWebServiceActivity;
|
||||
IExtendedUIService extUIService = (IExtendedUIService)Activity.Site.GetService(typeof(IExtendedUIService));
|
||||
if (extUIService != null && invokeWebServiceDecl.ProxyClass != null)
|
||||
{
|
||||
Uri uri = extUIService.GetUrlForProxyClass(invokeWebServiceDecl.ProxyClass);
|
||||
this.url = (uri != null) ? uri.ToString() : string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
return this.url;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this.url != value)
|
||||
{
|
||||
this.url = value;
|
||||
|
||||
IExtendedUIService extUIService = (IExtendedUIService)Activity.Site.GetService(typeof(IExtendedUIService));
|
||||
if (extUIService == null)
|
||||
throw new InvalidOperationException(SR.GetString(SR.General_MissingService, typeof(IExtendedUIService).FullName));
|
||||
|
||||
//Create the designer transaction
|
||||
DesignerTransaction trans = null;
|
||||
IDesignerHost host = Activity.Site.GetService(typeof(IDesignerHost)) as IDesignerHost;
|
||||
if (host != null)
|
||||
trans = host.CreateTransaction(SR.GetString(SR.ChangingVariable));
|
||||
try
|
||||
{
|
||||
PropertyDescriptorUtils.SetPropertyValue(Activity.Site, TypeDescriptor.GetProperties(Activity)["ProxyClass"], Activity, string.IsNullOrEmpty(this.url) ? null : extUIService.GetProxyClassForUrl(new Uri(this.url)));
|
||||
if (trans != null)
|
||||
trans.Commit();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (trans != null)
|
||||
((IDisposable)trans).Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnActivityChanged(ActivityChangedEventArgs e)
|
||||
{
|
||||
base.OnActivityChanged(e);
|
||||
|
||||
if (e.Member != null)
|
||||
{
|
||||
if (e.Member.Name == "ProxyClass")
|
||||
{
|
||||
if (Activity.Site != null)
|
||||
{
|
||||
InvokeWebServiceActivity invokeWebServiceDecl = e.Activity as InvokeWebServiceActivity;
|
||||
PropertyDescriptorUtils.SetPropertyValue(Activity.Site, TypeDescriptor.GetProperties(Activity)["MethodName"], Activity, String.Empty);
|
||||
|
||||
IExtendedUIService extUIService = (IExtendedUIService)Activity.Site.GetService(typeof(IExtendedUIService));
|
||||
if (extUIService == null)
|
||||
throw new Exception(SR.GetString(SR.General_MissingService, typeof(IExtendedUIService).FullName));
|
||||
|
||||
if (invokeWebServiceDecl.ProxyClass == null)
|
||||
{
|
||||
this.url = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
Uri uri = extUIService.GetUrlForProxyClass(invokeWebServiceDecl.ProxyClass);
|
||||
this.url = (uri != null) ? uri.ToString() : string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((e.Member.Name == "MethodName" || e.Member.Name == "TargetWorkflow")
|
||||
&& e.Activity is InvokeWebServiceActivity)
|
||||
(e.Activity as InvokeWebServiceActivity).ParameterBindings.Clear();
|
||||
|
||||
if (e.Member.Name == "ProxyClass" || e.Member.Name == "MethodName")
|
||||
TypeDescriptor.Refresh(e.Activity);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region InvokeWebServiceDesignerTheme
|
||||
internal sealed class InvokeWebServiceDesignerTheme : ActivityDesignerTheme
|
||||
{
|
||||
public InvokeWebServiceDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0x94, 0xB6, 0xF7);
|
||||
this.BorderStyle = DashStyle.Solid;
|
||||
this.BackColorStart = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF);
|
||||
this.BackColorEnd = Color.FromArgb(0xFF, 0xA5, 0xC3, 0xF7);
|
||||
this.BackgroundStyle = LinearGradientMode.Horizontal;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Class WebServiceUrlPropertyDescriptor
|
||||
internal sealed class WebServiceUrlPropertyDescriptor : DynamicPropertyDescriptor
|
||||
{
|
||||
internal WebServiceUrlPropertyDescriptor(IServiceProvider serviceProvider, PropertyDescriptor pd)
|
||||
: base(serviceProvider, pd)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool IsReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
internal sealed class WebServicePickerEditor : UITypeEditor
|
||||
{
|
||||
private IWindowsFormsEditorService editorService;
|
||||
public WebServicePickerEditor()
|
||||
{
|
||||
}
|
||||
|
||||
public override object EditValue(ITypeDescriptorContext typeDescriptorContext, IServiceProvider serviceProvider, object o)
|
||||
{
|
||||
object returnVal = o;
|
||||
this.editorService = (IWindowsFormsEditorService)serviceProvider.GetService(typeof(IWindowsFormsEditorService));
|
||||
IExtendedUIService extUIService = (IExtendedUIService)serviceProvider.GetService(typeof(IExtendedUIService));
|
||||
if (editorService != null && extUIService != null)
|
||||
{
|
||||
Uri url = null;
|
||||
Type proxyClass = null;
|
||||
|
||||
if (DialogResult.OK == extUIService.AddWebReference(out url, out proxyClass))
|
||||
{
|
||||
returnVal = (url != null) ? url.ToString() : string.Empty;
|
||||
typeDescriptorContext.PropertyDescriptor.SetValue(typeDescriptorContext.Instance, returnVal as string);
|
||||
}
|
||||
}
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext typeDescriptorContext)
|
||||
{
|
||||
return UITypeEditorEditStyle.Modal;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.CodeDom;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing.Design;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Diagnostics;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
#region Class ListenToolboxItem
|
||||
[Serializable]
|
||||
internal sealed class ListenToolboxItem : ActivityToolboxItem
|
||||
{
|
||||
public ListenToolboxItem(Type type)
|
||||
: base(type)
|
||||
{
|
||||
}
|
||||
private ListenToolboxItem(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
Deserialize(info, context);
|
||||
}
|
||||
protected override IComponent[] CreateComponentsCore(IDesignerHost designerHost)
|
||||
{
|
||||
CompositeActivity listenActivity = new ListenActivity();
|
||||
listenActivity.Activities.Add(new EventDrivenActivity());
|
||||
listenActivity.Activities.Add(new EventDrivenActivity());
|
||||
return (IComponent[])new IComponent[] { listenActivity };
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Class ListenDesigner
|
||||
[ActivityDesignerTheme(typeof(ListenDesignerTheme))]
|
||||
internal sealed class ListenDesigner : ParallelActivityDesigner
|
||||
{
|
||||
#region Properties and Methods
|
||||
public override bool CanInsertActivities(HitTestInfo insertLocation, ReadOnlyCollection<Activity> activitiesToInsert)
|
||||
{
|
||||
foreach (Activity activity in activitiesToInsert)
|
||||
{
|
||||
if (!(activity is EventDrivenActivity))
|
||||
return false;
|
||||
}
|
||||
return base.CanInsertActivities(insertLocation, activitiesToInsert);
|
||||
}
|
||||
|
||||
protected override CompositeActivity OnCreateNewBranch()
|
||||
{
|
||||
return new EventDrivenActivity();
|
||||
}
|
||||
|
||||
protected override void OnPaint(ActivityDesignerPaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
if (!Expanded || ContainedDesigners.Count == 0 || this != ActiveView.AssociatedDesigner)
|
||||
return;
|
||||
|
||||
CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;
|
||||
Debug.Assert(compositeDesignerTheme != null);
|
||||
if (compositeDesignerTheme == null)
|
||||
return;
|
||||
|
||||
//Draw the Icon and Text
|
||||
Rectangle bounds = Bounds;
|
||||
Rectangle imageRectangle = ImageRectangle;
|
||||
|
||||
Rectangle roundRectangle = Rectangle.Empty;
|
||||
roundRectangle.Width = compositeDesignerTheme.ConnectorSize.Height - 2 * e.AmbientTheme.Margin.Height - 1;
|
||||
roundRectangle.Height = roundRectangle.Width;
|
||||
roundRectangle.X = bounds.Left + bounds.Width / 2 - roundRectangle.Width / 2;
|
||||
roundRectangle.Y = bounds.Top + TitleHeight + (compositeDesignerTheme.ConnectorSize.Height * 3 / 2 - roundRectangle.Height) / 2;
|
||||
|
||||
e.Graphics.FillEllipse(compositeDesignerTheme.ForegroundBrush, roundRectangle);
|
||||
e.Graphics.DrawEllipse(compositeDesignerTheme.ForegroundPen, roundRectangle);
|
||||
|
||||
roundRectangle.Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height * 3 / 2 + (compositeDesignerTheme.ConnectorSize.Height * 3 / 2 - roundRectangle.Height) / 2;
|
||||
e.Graphics.FillEllipse(compositeDesignerTheme.ForegroundBrush, roundRectangle);
|
||||
e.Graphics.DrawEllipse(compositeDesignerTheme.ForegroundPen, roundRectangle);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ListenDesignerTheme
|
||||
internal sealed class ListenDesignerTheme : CompositeDesignerTheme
|
||||
{
|
||||
public ListenDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.ShowDropShadow = false;
|
||||
this.ConnectorStartCap = LineAnchor.None;
|
||||
this.ConnectorEndCap = LineAnchor.None;
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x80, 0x00, 0x00);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0xE0, 0xE0, 0xE0);
|
||||
this.BorderStyle = DashStyle.Dash;
|
||||
this.BackColorStart = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
this.BackColorEnd = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.CodeDom;
|
||||
using System.ComponentModel;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing.Design;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
#region Class ParallelToolboxItem
|
||||
[Serializable]
|
||||
internal sealed class ParallelToolboxItem : ActivityToolboxItem
|
||||
{
|
||||
public ParallelToolboxItem(Type type)
|
||||
: base(type)
|
||||
{
|
||||
}
|
||||
private ParallelToolboxItem(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
Deserialize(info, context);
|
||||
}
|
||||
protected override IComponent[] CreateComponentsCore(IDesignerHost designerHost)
|
||||
{
|
||||
CompositeActivity parallelActivity = new ParallelActivity();
|
||||
parallelActivity.Activities.Add(new SequenceActivity());
|
||||
parallelActivity.Activities.Add(new SequenceActivity());
|
||||
return (IComponent[])new IComponent[] { parallelActivity };
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Class ParallelDesigner
|
||||
[ActivityDesignerTheme(typeof(ParallelDesignerTheme))]
|
||||
internal sealed class ParallelDesigner : ParallelActivityDesigner
|
||||
{
|
||||
#region Properties and Methods
|
||||
protected override CompositeActivity OnCreateNewBranch()
|
||||
{
|
||||
return new SequenceActivity();
|
||||
}
|
||||
|
||||
public override bool CanInsertActivities(HitTestInfo insertLocation, ReadOnlyCollection<Activity> activitiesToInsert)
|
||||
{
|
||||
foreach (Activity activity in activitiesToInsert)
|
||||
{
|
||||
if (activity.GetType() != typeof(SequenceActivity))
|
||||
return false;
|
||||
}
|
||||
return base.CanInsertActivities(insertLocation, activitiesToInsert);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ParallelDesignerTheme
|
||||
internal sealed class ParallelDesignerTheme : CompositeDesignerTheme
|
||||
{
|
||||
public ParallelDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.ShowDropShadow = false;
|
||||
this.ConnectorStartCap = LineAnchor.None;
|
||||
this.ConnectorEndCap = LineAnchor.None;
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x80, 0x00, 0x80);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0xE0, 0xE0, 0xE0);
|
||||
this.BorderStyle = DashStyle.Dash;
|
||||
this.BackColorStart = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
this.BackColorEnd = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.CodeDom;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
using System.Workflow.ComponentModel.Compiler;
|
||||
using System.Workflow.Activities.Rules;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms.Design;
|
||||
using System.Workflow.Activities.Rules.Design;
|
||||
using System.Windows.Forms;
|
||||
using System.Workflow.Activities.Common;
|
||||
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
[ActivityDesignerTheme(typeof(PolicyDesignerTheme))]
|
||||
internal sealed class PolicyDesigner : ActivityDesigner, IServiceProvider
|
||||
{
|
||||
new public object GetService(Type type)
|
||||
{
|
||||
return base.GetService(type);
|
||||
}
|
||||
|
||||
protected override void DoDefaultAction()
|
||||
{
|
||||
base.DoDefaultAction();
|
||||
|
||||
// Do not allow editing if in debug mode.
|
||||
WorkflowDesignerLoader workflowDesignerLoader = this.GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;
|
||||
if (workflowDesignerLoader != null && workflowDesignerLoader.InDebugMode)
|
||||
throw new InvalidOperationException(Messages.DebugModeEditsDisallowed);
|
||||
|
||||
// Do not allow editing if locked
|
||||
PolicyActivity activity = (PolicyActivity)this.Activity;
|
||||
if (Helpers.IsActivityLocked(activity))
|
||||
return;
|
||||
|
||||
RuleDefinitions rules = ConditionHelper.Load_Rules_DT(this, Helpers.GetRootActivity(activity));
|
||||
if (rules != null)
|
||||
{
|
||||
RuleSetCollection ruleSetCollection = rules.RuleSets;
|
||||
RuleSetReference ruleSetReference = activity.RuleSetReference;
|
||||
RuleSet ruleSet = null;
|
||||
string ruleSetName = null;
|
||||
if (ruleSetReference != null
|
||||
&& !string.IsNullOrEmpty(ruleSetReference.RuleSetName))
|
||||
{
|
||||
ruleSetName = ruleSetReference.RuleSetName;
|
||||
if (ruleSetCollection.Contains(ruleSetName))
|
||||
{
|
||||
ruleSet = ruleSetCollection[ruleSetName];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ruleSetName = ruleSetCollection.GenerateRuleSetName();
|
||||
}
|
||||
using (RuleSetDialog dlg = new RuleSetDialog(activity, ruleSet))
|
||||
{
|
||||
if (DialogResult.OK == dlg.ShowDialog())
|
||||
{
|
||||
if (ruleSet != null) // modifying
|
||||
{
|
||||
ruleSetCollection.Remove(ruleSetName);
|
||||
}
|
||||
else // creating
|
||||
{
|
||||
dlg.RuleSet.Name = ruleSetName;
|
||||
activity.RuleSetReference = new RuleSetReference(ruleSetName);
|
||||
}
|
||||
ruleSetCollection.Add(dlg.RuleSet);
|
||||
ConditionHelper.Flush_Rules_DT(this, Helpers.GetRootActivity(activity));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// force revalidation by setting a property
|
||||
TypeDescriptor.GetProperties(activity)["RuleSetReference"].SetValue(activity, activity.RuleSetReference);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal sealed class PolicyDesignerTheme : ActivityDesignerTheme
|
||||
{
|
||||
public PolicyDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0x80, 0x80, 0x80);
|
||||
this.BorderStyle = DashStyle.Solid;
|
||||
this.BackColorStart = Color.FromArgb(0xFF, 0xF4, 0xF4, 0xF4);
|
||||
this.BackColorEnd = Color.FromArgb(0xFF, 0xC0, 0xC0, 0xC0);
|
||||
this.BackgroundStyle = LinearGradientMode.Horizontal;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.CodeDom;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.Design;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
using System.ComponentModel.Design.Serialization;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.CodeDom;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
|
||||
#region Class SequenceDesigner
|
||||
[ActivityDesignerTheme(typeof(SequenceDesignerTheme))]
|
||||
internal class SequenceDesigner : SequentialActivityDesigner
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SequenceDesignerTheme
|
||||
internal sealed class SequenceDesignerTheme : CompositeDesignerTheme
|
||||
{
|
||||
public SequenceDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.ShowDropShadow = false;
|
||||
this.ConnectorStartCap = LineAnchor.None;
|
||||
this.ConnectorEndCap = LineAnchor.ArrowAnchor;
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x00, 0x00, 0x73);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0xE0, 0xE0, 0xE0);
|
||||
this.BorderStyle = DashStyle.Dash;
|
||||
this.BackColorStart = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
this.BackColorEnd = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.CodeDom;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing.Design;
|
||||
using System.Reflection.Emit;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
using System.Workflow.ComponentModel.Compiler;
|
||||
using Microsoft.CSharp;
|
||||
using System.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Class SequentialWorkflowDesigner
|
||||
[ActivityDesignerTheme(typeof(SequentialWorkflowDesignerTheme))]
|
||||
internal class SequentialWorkflowDesigner : SequentialWorkflowRootDesigner
|
||||
{
|
||||
#region Members, Constructor and Destructor
|
||||
protected override void Initialize(Activity activity)
|
||||
{
|
||||
base.Initialize(activity);
|
||||
|
||||
HelpText = DR.GetString(DR.SequentialWorkflowHelpText);
|
||||
Header.Text = DR.GetString(DR.StartSequentialWorkflow);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
//TBD: NOTE, there needs to be two way protocol, the roots must indicate
|
||||
//what activities that they support and the activities must indicate
|
||||
//what root they support. The latter, is missing right now.
|
||||
//The following method just checks for the former.
|
||||
protected override bool IsSupportedActivityType(Type activityType)
|
||||
{
|
||||
//we specifically, do not support state machine related activities.
|
||||
if (typeof(SetStateActivity).IsAssignableFrom(activityType) ||
|
||||
typeof(StateActivity).IsAssignableFrom(activityType) ||
|
||||
typeof(StateInitializationActivity).IsAssignableFrom(activityType) ||
|
||||
typeof(StateFinalizationActivity).IsAssignableFrom(activityType))
|
||||
return false;
|
||||
|
||||
return base.IsSupportedActivityType(activityType);
|
||||
}
|
||||
|
||||
#region MultiViewDesigner Support
|
||||
protected override void OnViewChanged(DesignerView view)
|
||||
{
|
||||
base.OnViewChanged(view);
|
||||
|
||||
ActivityDesigner hostedDesigner = (ActiveView != null) ? ActiveView.AssociatedDesigner : null;
|
||||
if (hostedDesigner.Activity is FaultHandlersActivity)
|
||||
{
|
||||
Header.Text = DR.GetString(DR.WorkflowExceptions);
|
||||
HelpText = String.Empty;
|
||||
}
|
||||
else if (hostedDesigner.Activity is EventHandlersActivity)
|
||||
{
|
||||
Header.Text = DR.GetString(DR.WorkflowEvents);
|
||||
HelpText = String.Empty;
|
||||
}
|
||||
else if (hostedDesigner.Activity is CompensationHandlerActivity)
|
||||
{
|
||||
Header.Text = DR.GetString(DR.WorkflowCompensation);
|
||||
HelpText = String.Empty;
|
||||
}
|
||||
else if (hostedDesigner.Activity is CancellationHandlerActivity)
|
||||
{
|
||||
Header.Text = DR.GetString(DR.WorkflowCancellation);
|
||||
HelpText = String.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
Header.Text = DR.GetString(DR.StartSequentialWorkflow);
|
||||
HelpText = DR.GetString(DR.SequentialWorkflowHelpText);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SequentialWorkflowWithDataContextDesignerTheme
|
||||
internal sealed class SequentialWorkflowDesignerTheme : CompositeDesignerTheme
|
||||
{
|
||||
public SequentialWorkflowDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.WatermarkImagePath = "System.Workflow.Activities.ActivityDesignerResources.SequentialWorkflowDesigner";
|
||||
this.WatermarkAlignment = DesignerContentAlignment.BottomRight;
|
||||
this.ShowDropShadow = true;
|
||||
this.ConnectorStartCap = LineAnchor.None;
|
||||
this.ConnectorEndCap = LineAnchor.ArrowAnchor;
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0x49, 0x77, 0xB4);
|
||||
this.BorderStyle = DashStyle.Solid;
|
||||
this.BackColorStart = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
this.BackColorEnd = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.CodeDom;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing.Design;
|
||||
using System.Reflection.Emit;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
using System.Workflow.ComponentModel.Compiler;
|
||||
using Microsoft.CSharp;
|
||||
using System.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Class SequentialWorkflowDesigner
|
||||
[ActivityDesignerTheme(typeof(SequentialWorkflowDesignerTheme))]
|
||||
internal class SequentialWorkflowDesigner : SequentialWorkflowRootDesigner
|
||||
{
|
||||
#region Members, Constructor and Destructor
|
||||
protected override void Initialize(Activity activity)
|
||||
{
|
||||
base.Initialize(activity);
|
||||
|
||||
HelpText = DR.GetString(DR.SequentialWorkflowHelpText);
|
||||
Header.Text = DR.GetString(DR.StartSequentialWorkflow);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
//TBD: NOTE, there needs to be two way protocol, the roots must indicate
|
||||
//what activities that they support and the activities must indicate
|
||||
//what root they support. The latter, is missing right now.
|
||||
//The following method just checks for the former.
|
||||
protected override bool IsSupportedActivityType(Type activityType)
|
||||
{
|
||||
//we specifically, do not support state machine related activities.
|
||||
if (typeof(SetStateActivity).IsAssignableFrom(activityType) ||
|
||||
typeof(StateActivity).IsAssignableFrom(activityType) ||
|
||||
typeof(StateInitializationActivity).IsAssignableFrom(activityType) ||
|
||||
typeof(StateFinalizationActivity).IsAssignableFrom(activityType))
|
||||
return false;
|
||||
|
||||
return base.IsSupportedActivityType(activityType);
|
||||
}
|
||||
|
||||
#region MultiViewDesigner Support
|
||||
protected override void OnViewChanged(DesignerView view)
|
||||
{
|
||||
base.OnViewChanged(view);
|
||||
|
||||
ActivityDesigner hostedDesigner = (ActiveView != null) ? ActiveView.AssociatedDesigner : null;
|
||||
if (hostedDesigner.Activity is FaultHandlersActivity)
|
||||
{
|
||||
Header.Text = DR.GetString(DR.WorkflowExceptions);
|
||||
HelpText = String.Empty;
|
||||
}
|
||||
else if (hostedDesigner.Activity is EventHandlersActivity)
|
||||
{
|
||||
Header.Text = DR.GetString(DR.WorkflowEvents);
|
||||
HelpText = String.Empty;
|
||||
}
|
||||
else if (hostedDesigner.Activity is CompensationHandlerActivity)
|
||||
{
|
||||
Header.Text = DR.GetString(DR.WorkflowCompensation);
|
||||
HelpText = String.Empty;
|
||||
}
|
||||
else if (hostedDesigner.Activity is CancellationHandlerActivity)
|
||||
{
|
||||
Header.Text = DR.GetString(DR.WorkflowCancellation);
|
||||
HelpText = String.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
Header.Text = DR.GetString(DR.StartSequentialWorkflow);
|
||||
HelpText = DR.GetString(DR.SequentialWorkflowHelpText);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SequentialWorkflowWithDataContextDesignerTheme
|
||||
internal sealed class SequentialWorkflowDesignerTheme : CompositeDesignerTheme
|
||||
{
|
||||
public SequentialWorkflowDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.WatermarkImagePath = "System.Workflow.Activities.ActivityDesignerResources.SequentialWorkflowDesigner";
|
||||
this.Watermar----gnment = DesignerContentAlignment.BottomRight;
|
||||
this.ShowDropShadow = true;
|
||||
this.ConnectorStartCap = LineAnchor.None;
|
||||
this.ConnectorEndCap = LineAnchor.ArrowAnchor;
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0x49, 0x77, 0xB4);
|
||||
this.BorderStyle = DashStyle.Solid;
|
||||
this.BackColorStart = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
this.BackColorEnd = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,341 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.CodeDom;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
using System.Workflow.Activities;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.Design;
|
||||
|
||||
#region Class SetStateDesigner
|
||||
|
||||
[ActivityDesignerTheme(typeof(SetStateDesignerTheme))]
|
||||
[System.Runtime.InteropServices.ComVisible(false)]
|
||||
internal sealed class SetStateDesigner : ActivityDesigner
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private string previousTargetState = String.Empty;
|
||||
private Size targetStateSize = Size.Empty;
|
||||
|
||||
#endregion Fields
|
||||
|
||||
#region Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
|
||||
protected override Rectangle TextRectangle
|
||||
{
|
||||
get
|
||||
{
|
||||
Size margin = WorkflowTheme.CurrentTheme.AmbientTheme.Margin;
|
||||
Rectangle textRectangle = base.TextRectangle;
|
||||
textRectangle.Offset(0, (-targetStateSize.Height - margin.Height) / 2);
|
||||
return textRectangle;
|
||||
}
|
||||
}
|
||||
|
||||
protected override Rectangle ImageRectangle
|
||||
{
|
||||
get
|
||||
{
|
||||
Size margin = WorkflowTheme.CurrentTheme.AmbientTheme.Margin;
|
||||
Rectangle imageRectangle = base.ImageRectangle;
|
||||
imageRectangle.Offset(0, (-targetStateSize.Height - margin.Height) / 2);
|
||||
return imageRectangle;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string TargetState
|
||||
{
|
||||
get
|
||||
{
|
||||
SetStateActivity setState = this.Activity as SetStateActivity;
|
||||
if (setState == null)
|
||||
return String.Empty;
|
||||
|
||||
string targetState = setState.TargetStateName;
|
||||
if (targetState == null)
|
||||
return String.Empty;
|
||||
|
||||
return targetState;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of text rectangle in logical coordinates.
|
||||
/// </summary>
|
||||
internal Rectangle TargetStateRectangle
|
||||
{
|
||||
get
|
||||
{
|
||||
Size margin = WorkflowTheme.CurrentTheme.AmbientTheme.Margin;
|
||||
|
||||
Rectangle bounds = this.Bounds;
|
||||
Rectangle textRectangle = this.TextRectangle;
|
||||
Point location = new Point(
|
||||
bounds.Left + margin.Width,
|
||||
textRectangle.Bottom + (margin.Height / 2));
|
||||
Size size = new Size(
|
||||
bounds.Width - margin.Width * 2,
|
||||
targetStateSize.Height);
|
||||
return new Rectangle(location, size);
|
||||
}
|
||||
}
|
||||
#endregion Private Properties
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public override bool CanBeParentedTo(CompositeActivityDesigner parentActivityDesigner)
|
||||
{
|
||||
if (parentActivityDesigner == null)
|
||||
throw new ArgumentNullException("parentActivityDesigner");
|
||||
|
||||
CompositeActivity parentActivity = parentActivityDesigner.Activity as CompositeActivity;
|
||||
if (parentActivity == null)
|
||||
return false;
|
||||
|
||||
bool result = ValidateParent(parentActivity);
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
return base.CanBeParentedTo(parentActivityDesigner);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnActivityChanged(ActivityChangedEventArgs e)
|
||||
{
|
||||
base.OnActivityChanged(e);
|
||||
|
||||
if (previousTargetState != this.TargetState)
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called to set the size of the visual cues or designers contained within the designer.
|
||||
/// </summary>
|
||||
/// <param name="e">ActivityDesignerLayoutEventArgs holding layout arguments</param>
|
||||
protected override Size OnLayoutSize(ActivityDesignerLayoutEventArgs e)
|
||||
{
|
||||
Size size = base.OnLayoutSize(e);
|
||||
|
||||
string targetState = this.TargetState;
|
||||
if (String.IsNullOrEmpty(targetState))
|
||||
{
|
||||
// We use a dummy string so we don't
|
||||
// calculate an empty rectangle
|
||||
targetState = "M";
|
||||
}
|
||||
|
||||
Font font = e.DesignerTheme.Font;
|
||||
|
||||
this.targetStateSize = StateMachineDesignerPaint.MeasureString(e.Graphics,
|
||||
font,
|
||||
targetState,
|
||||
StringAlignment.Near,
|
||||
Size.Empty);
|
||||
|
||||
size.Height += targetStateSize.Height;
|
||||
return size;
|
||||
}
|
||||
|
||||
protected override void OnPaint(ActivityDesignerPaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
string targetState = this.TargetState;
|
||||
|
||||
ActivityDesignerPaint.DrawText(e.Graphics,
|
||||
e.DesignerTheme.Font,
|
||||
targetState,
|
||||
this.TargetStateRectangle,
|
||||
StringAlignment.Center,
|
||||
e.AmbientTheme.TextQuality,
|
||||
e.DesignerTheme.ForegroundBrush);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Static Private Methods
|
||||
|
||||
static private bool ValidateParent(CompositeActivity parentActivity)
|
||||
{
|
||||
if (parentActivity == null)
|
||||
return false;
|
||||
|
||||
if (SetStateValidator.IsValidContainer(parentActivity))
|
||||
return true;
|
||||
|
||||
return ValidateParent(parentActivity.Parent);
|
||||
}
|
||||
|
||||
#endregion Static Private Methods
|
||||
|
||||
#endregion Methods
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetStateDesignerTheme
|
||||
internal sealed class SetStateDesignerTheme : ActivityDesignerTheme
|
||||
{
|
||||
public SetStateDesignerTheme(WorkflowTheme theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.ForeColor = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
|
||||
this.BorderColor = Color.FromArgb(0xFF, 0x80, 0x80, 0x80);
|
||||
this.BorderStyle = DashStyle.Solid;
|
||||
this.BackColorStart = Color.FromArgb(0xFF, 0xF4, 0xF4, 0xF4);
|
||||
this.BackColorEnd = Color.FromArgb(0xFF, 0xC0, 0xC0, 0xC0);
|
||||
this.BackgroundStyle = LinearGradientMode.Horizontal;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Class StateDropDownEditor
|
||||
|
||||
internal sealed class StateDropDownEditor : UITypeEditor
|
||||
{
|
||||
#region Fields
|
||||
private IWindowsFormsEditorService _editorService;
|
||||
private ITypeDescriptorContext _context;
|
||||
private object _selectedObject;
|
||||
#endregion Fields
|
||||
|
||||
#region Constructors/Destructors
|
||||
public StateDropDownEditor()
|
||||
{
|
||||
}
|
||||
#endregion Constructors/Destructors
|
||||
|
||||
#region Methods
|
||||
|
||||
#region Public Methods
|
||||
public override object EditValue(ITypeDescriptorContext typeDescriptorContext, IServiceProvider serviceProvider, object value)
|
||||
{
|
||||
if (typeDescriptorContext == null)
|
||||
throw new ArgumentNullException("typeDescriptorContext");
|
||||
if (serviceProvider == null)
|
||||
throw new ArgumentNullException("serviceProvider");
|
||||
_editorService = (IWindowsFormsEditorService)serviceProvider.GetService(typeof(IWindowsFormsEditorService));
|
||||
_context = typeDescriptorContext;
|
||||
|
||||
// Initialize the dropdown control
|
||||
ListBox dropDownList = new ListBox();
|
||||
dropDownList.BorderStyle = BorderStyle.None;
|
||||
|
||||
Activity activity = _context.Instance as Activity;
|
||||
if (activity == null)
|
||||
{
|
||||
// this could happen when there are multiple
|
||||
// SetState activities selected
|
||||
object[] activities = _context.Instance as object[];
|
||||
if (activities != null && activities.Length > 0)
|
||||
activity = (Activity)activities[0];
|
||||
}
|
||||
Debug.Assert(activity != null);
|
||||
|
||||
// Add the items from the typeconverter, followed by the datasource choices
|
||||
PopulateDropDownList(dropDownList, activity);
|
||||
|
||||
dropDownList.SelectedIndexChanged += new EventHandler(dataSourceDropDown_SelectedIndexChanged);
|
||||
|
||||
// Display the control
|
||||
_editorService.DropDownControl(dropDownList);
|
||||
|
||||
// If a value was selected, read the selected value from the control and return it
|
||||
if (dropDownList.SelectedIndex != -1 && _selectedObject != null)
|
||||
return _selectedObject;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext typeDescriptorContext)
|
||||
{
|
||||
return UITypeEditorEditStyle.DropDown;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void dataSourceDropDown_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
_editorService.CloseDropDown();
|
||||
_selectedObject = null;
|
||||
|
||||
ListBox dropDownList = sender as ListBox;
|
||||
if (dropDownList == null)
|
||||
throw new ArgumentNullException("sender");
|
||||
|
||||
if (dropDownList.SelectedIndex < 0)
|
||||
return;
|
||||
|
||||
_selectedObject = dropDownList.Items[dropDownList.SelectedIndex];
|
||||
}
|
||||
|
||||
private void PopulateDropDownList(ListBox dropDownList, Activity activity)
|
||||
{
|
||||
Debug.Assert(dropDownList != null);
|
||||
Debug.Assert(activity != null);
|
||||
|
||||
StateActivity enclosingState = StateMachineHelpers.FindEnclosingState(activity);
|
||||
if (enclosingState == null)
|
||||
return;
|
||||
|
||||
StateActivity rootState = StateMachineHelpers.GetRootState(enclosingState);
|
||||
|
||||
FindStates(dropDownList, rootState);
|
||||
}
|
||||
|
||||
private void FindStates(ListBox dropDownList, StateActivity parent)
|
||||
{
|
||||
foreach (Activity activity in parent.EnabledActivities)
|
||||
{
|
||||
StateActivity state = activity as StateActivity;
|
||||
if (state != null)
|
||||
{
|
||||
if (StateMachineHelpers.IsLeafState(state))
|
||||
{
|
||||
dropDownList.Items.Add(state.QualifiedName);
|
||||
}
|
||||
else
|
||||
{
|
||||
FindStates(dropDownList, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
|
||||
#endregion Class StateDropDownEditor
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.CodeDom;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing.Design;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Design;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
internal partial class StateDesigner : FreeformActivityDesigner
|
||||
{
|
||||
private class CommentLayoutGlyph : DesignerGlyph
|
||||
{
|
||||
private Layout _layout;
|
||||
|
||||
public CommentLayoutGlyph(Layout layout)
|
||||
{
|
||||
if (layout == null)
|
||||
throw new ArgumentNullException("layout");
|
||||
|
||||
_layout = layout;
|
||||
}
|
||||
|
||||
public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
|
||||
{
|
||||
if (designer == null)
|
||||
throw new ArgumentNullException("designer");
|
||||
|
||||
Rectangle bounds = _layout.Bounds;
|
||||
return bounds;
|
||||
}
|
||||
|
||||
public override int Priority
|
||||
{
|
||||
get
|
||||
{
|
||||
return DesignerGlyph.NormalPriority;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
|
||||
{
|
||||
if (designer == null)
|
||||
throw new ArgumentNullException("designer");
|
||||
if (graphics == null)
|
||||
throw new ArgumentNullException("graphics");
|
||||
Rectangle bounds = GetBounds(designer, false);
|
||||
graphics.FillRectangle(StateMachineDesignerPaint.FadeBrush, bounds);
|
||||
graphics.FillRectangle(ambientTheme.CommentIndicatorBrush, bounds);
|
||||
graphics.DrawRectangle(ambientTheme.CommentIndicatorPen, bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user