Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / Design / WinOEToolBoxItem.cs / 1305376 / WinOEToolBoxItem.cs
namespace System.Workflow.ComponentModel.Design { using System; using System.Collections; using System.Drawing; using System.Drawing.Design; using System.ComponentModel; using System.Runtime.Serialization; using System.ComponentModel.Design; using System.Security.Permissions; using System.Reflection; [Serializable] [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")] [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")] public class ActivityToolboxItem: ToolboxItem { private const String ActivitySuffix = "Activity"; public ActivityToolboxItem() { } public ActivityToolboxItem(Type type):base(type) { // if (type != null) { if (type.Name != null) { string name = type.Name; if ((type.Assembly == Assembly.GetExecutingAssembly() || type.Assembly != null && type.Assembly.FullName != null && type.Assembly.FullName.Equals(AssemblyRef.ActivitiesAssemblyRef, StringComparison.OrdinalIgnoreCase)) && type.Name.EndsWith(ActivitySuffix, StringComparison.Ordinal) && !type.Name.Equals(ActivitySuffix, StringComparison.Ordinal)) { name = type.Name.Substring(0, type.Name.Length - ActivitySuffix.Length); } base.DisplayName = name; } base.Description = ActivityDesigner.GetActivityDescription(type); } } protected ActivityToolboxItem(SerializationInfo info, StreamingContext context) { Deserialize(info, context); } public virtual IComponent[] CreateComponentsWithUI(IDesignerHost host) { return CreateComponentsCore(host); } // protected override IComponent[] CreateComponentsCore(IDesignerHost host) { Type typeOfComponent = GetType(host, AssemblyName, TypeName, true); if (typeOfComponent == null && host != null) typeOfComponent = host.GetType(TypeName); if (typeOfComponent == null) { ITypeProviderCreator tpc = null; if (host != null) tpc = (ITypeProviderCreator)host.GetService(typeof(ITypeProviderCreator)); if (tpc != null) { System.Reflection.Assembly assembly = tpc.GetTransientAssembly(this.AssemblyName); if (assembly != null) typeOfComponent = assembly.GetType(this.TypeName); } if (typeOfComponent == null) typeOfComponent = GetType(host, AssemblyName, TypeName, true); } ArrayList comps = new ArrayList(); if (typeOfComponent != null) { if (typeof(IComponent).IsAssignableFrom(typeOfComponent)) comps.Add(TypeDescriptor.CreateInstance(null, typeOfComponent, null, null)); } IComponent[] temp = new IComponent[comps.Count]; comps.CopyTo(temp, 0); return temp; } public static Image GetToolboxImage(Type activityType) { if (activityType == null) throw new ArgumentNullException("activityType"); Image toolBoxImage = null; if (activityType != null) { object[] attribs = activityType.GetCustomAttributes(typeof(ToolboxBitmapAttribute), false); if (attribs != null && attribs.GetLength(0) == 0) attribs = activityType.GetCustomAttributes(typeof(ToolboxBitmapAttribute), true); ToolboxBitmapAttribute toolboxBitmapAttribute = (attribs != null && attribs.GetLength(0) > 0) ? attribs[0] as ToolboxBitmapAttribute : null; if (toolboxBitmapAttribute != null) toolBoxImage = toolboxBitmapAttribute.GetImage(activityType); } return toolBoxImage; } public static string GetToolboxDisplayName(Type activityType) { if (activityType == null) throw new ArgumentNullException("activityType"); string displayName = activityType.Name; object[] toolboxItemAttributes = activityType.GetCustomAttributes(typeof(ToolboxItemAttribute), true); if (toolboxItemAttributes != null && toolboxItemAttributes.Length > 0) { ToolboxItemAttribute toolboxItemAttrib = toolboxItemAttributes[0] as ToolboxItemAttribute; if (toolboxItemAttrib != null && toolboxItemAttrib.ToolboxItemType != null) { try { ToolboxItem item = Activator.CreateInstance(toolboxItemAttrib.ToolboxItemType, new object[] { activityType }) as ToolboxItem; if (item != null) displayName = item.DisplayName; } catch { } } } if (activityType.Assembly != null && activityType.Assembly.FullName != null) { if ((activityType.Assembly.FullName.Equals(AssemblyRef.ActivitiesAssemblyRef, StringComparison.OrdinalIgnoreCase) || activityType.Assembly.FullName.Equals(Assembly.GetExecutingAssembly().FullName, StringComparison.OrdinalIgnoreCase)) && displayName.EndsWith(ActivitySuffix, StringComparison.Ordinal) && !displayName.Equals(ActivitySuffix, StringComparison.Ordinal)) { displayName = displayName.Substring(0, displayName.Length - ActivitySuffix.Length); } } return displayName; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. namespace System.Workflow.ComponentModel.Design { using System; using System.Collections; using System.Drawing; using System.Drawing.Design; using System.ComponentModel; using System.Runtime.Serialization; using System.ComponentModel.Design; using System.Security.Permissions; using System.Reflection; [Serializable] [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")] [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")] public class ActivityToolboxItem: ToolboxItem { private const String ActivitySuffix = "Activity"; public ActivityToolboxItem() { } public ActivityToolboxItem(Type type):base(type) { // if (type != null) { if (type.Name != null) { string name = type.Name; if ((type.Assembly == Assembly.GetExecutingAssembly() || type.Assembly != null && type.Assembly.FullName != null && type.Assembly.FullName.Equals(AssemblyRef.ActivitiesAssemblyRef, StringComparison.OrdinalIgnoreCase)) && type.Name.EndsWith(ActivitySuffix, StringComparison.Ordinal) && !type.Name.Equals(ActivitySuffix, StringComparison.Ordinal)) { name = type.Name.Substring(0, type.Name.Length - ActivitySuffix.Length); } base.DisplayName = name; } base.Description = ActivityDesigner.GetActivityDescription(type); } } protected ActivityToolboxItem(SerializationInfo info, StreamingContext context) { Deserialize(info, context); } public virtual IComponent[] CreateComponentsWithUI(IDesignerHost host) { return CreateComponentsCore(host); } // protected override IComponent[] CreateComponentsCore(IDesignerHost host) { Type typeOfComponent = GetType(host, AssemblyName, TypeName, true); if (typeOfComponent == null && host != null) typeOfComponent = host.GetType(TypeName); if (typeOfComponent == null) { ITypeProviderCreator tpc = null; if (host != null) tpc = (ITypeProviderCreator)host.GetService(typeof(ITypeProviderCreator)); if (tpc != null) { System.Reflection.Assembly assembly = tpc.GetTransientAssembly(this.AssemblyName); if (assembly != null) typeOfComponent = assembly.GetType(this.TypeName); } if (typeOfComponent == null) typeOfComponent = GetType(host, AssemblyName, TypeName, true); } ArrayList comps = new ArrayList(); if (typeOfComponent != null) { if (typeof(IComponent).IsAssignableFrom(typeOfComponent)) comps.Add(TypeDescriptor.CreateInstance(null, typeOfComponent, null, null)); } IComponent[] temp = new IComponent[comps.Count]; comps.CopyTo(temp, 0); return temp; } public static Image GetToolboxImage(Type activityType) { if (activityType == null) throw new ArgumentNullException("activityType"); Image toolBoxImage = null; if (activityType != null) { object[] attribs = activityType.GetCustomAttributes(typeof(ToolboxBitmapAttribute), false); if (attribs != null && attribs.GetLength(0) == 0) attribs = activityType.GetCustomAttributes(typeof(ToolboxBitmapAttribute), true); ToolboxBitmapAttribute toolboxBitmapAttribute = (attribs != null && attribs.GetLength(0) > 0) ? attribs[0] as ToolboxBitmapAttribute : null; if (toolboxBitmapAttribute != null) toolBoxImage = toolboxBitmapAttribute.GetImage(activityType); } return toolBoxImage; } public static string GetToolboxDisplayName(Type activityType) { if (activityType == null) throw new ArgumentNullException("activityType"); string displayName = activityType.Name; object[] toolboxItemAttributes = activityType.GetCustomAttributes(typeof(ToolboxItemAttribute), true); if (toolboxItemAttributes != null && toolboxItemAttributes.Length > 0) { ToolboxItemAttribute toolboxItemAttrib = toolboxItemAttributes[0] as ToolboxItemAttribute; if (toolboxItemAttrib != null && toolboxItemAttrib.ToolboxItemType != null) { try { ToolboxItem item = Activator.CreateInstance(toolboxItemAttrib.ToolboxItemType, new object[] { activityType }) as ToolboxItem; if (item != null) displayName = item.DisplayName; } catch { } } } if (activityType.Assembly != null && activityType.Assembly.FullName != null) { if ((activityType.Assembly.FullName.Equals(AssemblyRef.ActivitiesAssemblyRef, StringComparison.OrdinalIgnoreCase) || activityType.Assembly.FullName.Equals(Assembly.GetExecutingAssembly().FullName, StringComparison.OrdinalIgnoreCase)) && displayName.EndsWith(ActivitySuffix, StringComparison.Ordinal) && !displayName.Equals(ActivitySuffix, StringComparison.Ordinal)) { displayName = displayName.Substring(0, displayName.Length - ActivitySuffix.Length); } } return displayName; } } } // 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
- DllNotFoundException.cs
- StylusPointDescription.cs
- WebZone.cs
- IApplicationTrustManager.cs
- DataGridCommandEventArgs.cs
- LogicalExpr.cs
- HGlobalSafeHandle.cs
- Part.cs
- ConnectivityStatus.cs
- ExternalException.cs
- RichListBox.cs
- MemberProjectedSlot.cs
- IntegerValidator.cs
- NestPullup.cs
- WebPartUtil.cs
- StretchValidation.cs
- XmlEncodedRawTextWriter.cs
- IndicCharClassifier.cs
- SqlParameterCollection.cs
- WebPartVerbCollection.cs
- IncomingWebRequestContext.cs
- PeerNameRecord.cs
- cookiecontainer.cs
- EndEvent.cs
- EntityContainerEntitySet.cs
- GridViewPageEventArgs.cs
- Typography.cs
- ConcurrencyBehavior.cs
- SchemaRegistration.cs
- ContractCodeDomInfo.cs
- ByteStreamMessageEncoderFactory.cs
- XsdSchemaFileEditor.cs
- HttpCachePolicyElement.cs
- HttpCachePolicyElement.cs
- UpdateExpressionVisitor.cs
- DiagnosticTrace.cs
- OrderPreservingMergeHelper.cs
- ListBindingConverter.cs
- CrossSiteScriptingValidation.cs
- GroupBoxRenderer.cs
- pingexception.cs
- XPathNodeList.cs
- CalendarDayButton.cs
- WindowsPen.cs
- CodeSnippetTypeMember.cs
- UnhandledExceptionEventArgs.cs
- StringUtil.cs
- TextCompositionEventArgs.cs
- ZipIOCentralDirectoryBlock.cs
- InvariantComparer.cs
- Transform.cs
- GestureRecognitionResult.cs
- OdbcReferenceCollection.cs
- GlyphTypeface.cs
- Point4D.cs
- AmbientProperties.cs
- SHA1.cs
- Path.cs
- FlowLayout.cs
- WebPartVerb.cs
- PersonalizationProvider.cs
- QilUnary.cs
- MouseGesture.cs
- SplitterPanel.cs
- ScopelessEnumAttribute.cs
- DesignerActionKeyboardBehavior.cs
- Latin1Encoding.cs
- Oid.cs
- DeobfuscatingStream.cs
- XmlSerializerNamespaces.cs
- ActiveXHelper.cs
- GridViewColumnHeader.cs
- ToolStripDropDownItemDesigner.cs
- AppDomainFactory.cs
- Error.cs
- SplitterEvent.cs
- GridViewCommandEventArgs.cs
- HttpStreamFormatter.cs
- CachedResourceDictionaryExtension.cs
- DbProviderServices.cs
- Geometry.cs
- DynamicValidatorEventArgs.cs
- JournalEntryListConverter.cs
- AsmxEndpointPickerExtension.cs
- OperandQuery.cs
- IncrementalReadDecoders.cs
- PositiveTimeSpanValidator.cs
- WebControlParameterProxy.cs
- AuthenticationModulesSection.cs
- AttributeConverter.cs
- AncillaryOps.cs
- PersonalizationDictionary.cs
- DataControlButton.cs
- EncryptedPackage.cs
- BaseCollection.cs
- MgmtResManager.cs
- Trace.cs
- QuotedPrintableStream.cs
- PageHandlerFactory.cs
- PopOutPanel.cs