Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Activities / Designers / ListenDesigner.cs / 1305376 / ListenDesigner.cs
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 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
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
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 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
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MenuItemStyle.cs
- XmlDigitalSignatureProcessor.cs
- SequenceFullException.cs
- PrintingPermission.cs
- ProxyHwnd.cs
- UnsafeNativeMethods.cs
- BaseDataBoundControl.cs
- ClientEventManager.cs
- AttachedAnnotation.cs
- HTTPRemotingHandler.cs
- SqlProvider.cs
- MultitargetingHelpers.cs
- _AuthenticationState.cs
- ManipulationStartingEventArgs.cs
- ItemCollection.cs
- ToolStripAdornerWindowService.cs
- SimpleRecyclingCache.cs
- DateRangeEvent.cs
- SecurityKeyUsage.cs
- ChineseLunisolarCalendar.cs
- ManagementQuery.cs
- DynamicObjectAccessor.cs
- IdentityManager.cs
- VirtualizingPanel.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- SourceInterpreter.cs
- DataSetViewSchema.cs
- DataMember.cs
- AnnotationResource.cs
- HebrewNumber.cs
- LassoHelper.cs
- CheckBoxPopupAdapter.cs
- ItemCollection.cs
- DataServiceQueryOfT.cs
- IpcChannelHelper.cs
- EnumerableRowCollection.cs
- uribuilder.cs
- CannotUnloadAppDomainException.cs
- Message.cs
- ProtocolsConfigurationEntry.cs
- WebPartTransformerAttribute.cs
- Journaling.cs
- DecoratedNameAttribute.cs
- AlphabeticalEnumConverter.cs
- ReversePositionQuery.cs
- QilInvokeEarlyBound.cs
- SymLanguageVendor.cs
- ApplicationServicesHostFactory.cs
- CheckBoxList.cs
- Rotation3DAnimation.cs
- XmlSchemaSimpleTypeList.cs
- IriParsingElement.cs
- TTSEngineTypes.cs
- MemberCollection.cs
- BulletDecorator.cs
- RawUIStateInputReport.cs
- CapabilitiesState.cs
- HideDisabledControlAdapter.cs
- ImageSourceConverter.cs
- GorillaCodec.cs
- RoleServiceManager.cs
- GlobalProxySelection.cs
- DatagramAdapter.cs
- EmptyControlCollection.cs
- DispatcherEventArgs.cs
- EventLogEntry.cs
- EditorPart.cs
- NonBatchDirectoryCompiler.cs
- EntityDataSourceViewSchema.cs
- WebPartConnectionsEventArgs.cs
- SemanticBasicElement.cs
- MethodToken.cs
- TextEvent.cs
- XmlAttributeOverrides.cs
- DataListGeneralPage.cs
- ComponentRenameEvent.cs
- GlobalProxySelection.cs
- SQLSingle.cs
- SafeNativeMethods.cs
- WebPartHeaderCloseVerb.cs
- EmptyStringExpandableObjectConverter.cs
- SQLDateTimeStorage.cs
- InOutArgument.cs
- XpsLiterals.cs
- SlipBehavior.cs
- DataAdapter.cs
- DataContractAttribute.cs
- DecoderFallbackWithFailureFlag.cs
- DataBinder.cs
- RuntimeComponentFilter.cs
- DirectoryNotFoundException.cs
- RuntimeComponentFilter.cs
- AssemblySettingAttributes.cs
- ForceCopyBuildProvider.cs
- PersonalizationAdministration.cs
- ActivityExecutorOperation.cs
- KeyGestureValueSerializer.cs
- jithelpers.cs
- DoubleAnimationClockResource.cs
- EntityCommandExecutionException.cs