1 namespace System.Workflow.Activities
2 {
3     using System;
4     using System.Text;
5     using System.Reflection;
6     using System.Collections;
7     using System.CodeDom;
8     using System.ComponentModel;
9     using System.ComponentModel.Design;
10     using System.Drawing;
11     using System.Drawing.Drawing2D;
12     using System.Workflow.ComponentModel;
13     using System.Workflow.ComponentModel.Design;
14     using System.Collections.ObjectModel;
15 
16     #region StateFinalizationDesigner
17     [ActivityDesignerTheme(typeof(StateFinalizationDesignerTheme))]
18     internal sealed class StateFinalizationDesigner : System.Workflow.Activities.SequenceDesigner
19     {
20         #region Properties and Methods
CanBeParentedTo(CompositeActivityDesigner parentActivityDesigner)21         public override bool CanBeParentedTo(CompositeActivityDesigner parentActivityDesigner)
22         {
23             if (parentActivityDesigner == null)
24                 throw new ArgumentNullException("parentActivityDesigner");
25 
26             if (!(parentActivityDesigner.Activity is StateActivity))
27                 return false;
28 
29             return base.CanBeParentedTo(parentActivityDesigner);
30         }
31 
DoDefaultAction()32         protected override void DoDefaultAction()
33         {
34             base.DoDefaultAction();
35             EnsureVisible();
36         }
37 
38         public override bool CanExpandCollapse
39         {
40             get
41             {
42                 return false;
43             }
44         }
45 
CanInsertActivities(HitTestInfo insertLocation, ReadOnlyCollection<Activity> activitiesToInsert)46         public override bool CanInsertActivities(HitTestInfo insertLocation, ReadOnlyCollection<Activity> activitiesToInsert)
47         {
48             foreach (Activity activity in activitiesToInsert)
49             {
50                 if (activity is IEventActivity)
51                     return false;
52             }
53 
54             return base.CanInsertActivities(insertLocation, activitiesToInsert);
55         }
56 
57         #endregion
58     }
59     #endregion
60 
61     #region StateFinalizationDesignerTheme
62     internal sealed class StateFinalizationDesignerTheme : CompositeDesignerTheme
63     {
StateFinalizationDesignerTheme(WorkflowTheme theme)64         public StateFinalizationDesignerTheme(WorkflowTheme theme)
65             : base(theme)
66         {
67             this.ShowDropShadow = false;
68             this.ConnectorStartCap = LineAnchor.None;
69             this.ConnectorEndCap = LineAnchor.ArrowAnchor;
70             this.ForeColor = Color.FromArgb(0xFF, 0x80, 0x00, 0x00);
71             this.BorderColor = Color.FromArgb(0xFF, 0xE0, 0xE0, 0xE0);
72             this.BorderStyle = DashStyle.Dash;
73             this.BackColorStart = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
74             this.BackColorEnd = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
75         }
76     }
77     #endregion
78 }
79