Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / Compiler / TypeSystem / EventInfo.cs / 1305376 / EventInfo.cs
namespace System.Workflow.ComponentModel.Compiler
{
using System;
using System.CodeDom;
using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
#region DesignTimeEventInfo
internal sealed class DesignTimeEventInfo: EventInfo
{
#region Members and Constructors
private string name;
private DesignTimeMethodInfo addMethod = null;
private DesignTimeMethodInfo removeMethod = null;
private Attribute[] attributes = null;
private MemberAttributes memberAttributes;
private DesignTimeType declaringType;
private CodeMemberEvent codeDomEvent;
internal DesignTimeEventInfo(DesignTimeType declaringType, CodeMemberEvent codeDomEvent)
{
if (declaringType == null)
{
throw new ArgumentNullException("Declaring Type");
}
if (codeDomEvent == null)
{
throw new ArgumentNullException("codeDomEvent");
}
this.declaringType = declaringType;
this.codeDomEvent = codeDomEvent;
this.name = Helper.EnsureTypeName(codeDomEvent.Name);
this.memberAttributes = codeDomEvent.Attributes;
this.addMethod = null;
this.removeMethod = null;
}
#endregion
#region Event Info overrides
public override MethodInfo GetAddMethod(bool nonPublic)
{
if (this.addMethod == null)
{
Type handlerType = declaringType.ResolveType(DesignTimeType.GetTypeNameFromCodeTypeReference(this.codeDomEvent.Type, declaringType));
if (handlerType != null)
{
CodeMemberMethod codeAddMethod = new CodeMemberMethod();
codeAddMethod.Name = "add_" + this.name;
codeAddMethod.ReturnType = new CodeTypeReference(typeof(void));
codeAddMethod.Parameters.Add(new CodeParameterDeclarationExpression(this.codeDomEvent.Type, "Handler"));
codeAddMethod.Attributes = this.memberAttributes;
this.addMethod = new DesignTimeMethodInfo(this.declaringType, codeAddMethod, true);
}
}
return this.addMethod;
}
public override MethodInfo GetRemoveMethod(bool nonPublic)
{
if (this.removeMethod == null)
{
Type handlerType = declaringType.ResolveType(DesignTimeType.GetTypeNameFromCodeTypeReference(this.codeDomEvent.Type, declaringType));
if (handlerType != null)
{
CodeMemberMethod codeRemoveMethod = new CodeMemberMethod();
codeRemoveMethod.Name = "remove_" + this.name;
codeRemoveMethod.ReturnType = new CodeTypeReference(typeof(void));
codeRemoveMethod.Parameters.Add(new CodeParameterDeclarationExpression(handlerType, "Handler"));
codeRemoveMethod.Attributes = this.memberAttributes;
this.removeMethod = new DesignTimeMethodInfo(declaringType, codeRemoveMethod, true);
}
}
return this.removeMethod;
}
public override MethodInfo GetRaiseMethod(bool nonPublic)
{
return null;
}
public override EventAttributes Attributes
{
//We're not interested in this flag
get
{
return default(EventAttributes);
}
}
#endregion
#region MemberInfo Overrides
public override string Name
{
get
{
return this.name;
}
}
public override Type DeclaringType
{
get
{
return this.declaringType;
}
}
public override Type ReflectedType
{
get
{
return this.declaringType;
}
}
public override object[] GetCustomAttributes(bool inherit)
{
return GetCustomAttributes(typeof(object), inherit);
}
public override object[] GetCustomAttributes(Type attributeType, bool inherit)
{
if (attributeType == null)
throw new ArgumentNullException("attributeType");
if (this.attributes == null)
this.attributes = Helper.LoadCustomAttributes(this.codeDomEvent.CustomAttributes, this.DeclaringType as DesignTimeType);
return Helper.GetCustomAttributes(attributeType, inherit, this.attributes, this);
}
public override bool IsDefined(Type attributeType, bool inherit)
{
if (attributeType == null)
throw new ArgumentNullException("attributeType");
if (this.attributes == null)
this.attributes = Helper.LoadCustomAttributes(this.codeDomEvent.CustomAttributes, this.DeclaringType as DesignTimeType);
if (Helper.IsDefined(attributeType, inherit, attributes, this))
return true;
return false;
}
#endregion
#region Helpers
internal bool IsPublic
{
get
{
return ((memberAttributes & MemberAttributes.Public) != 0);
}
}
internal bool IsStatic
{
get
{
return ((memberAttributes & MemberAttributes.Static) != 0);
}
}
#endregion
}
#endregion
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace System.Workflow.ComponentModel.Compiler
{
using System;
using System.CodeDom;
using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
#region DesignTimeEventInfo
internal sealed class DesignTimeEventInfo: EventInfo
{
#region Members and Constructors
private string name;
private DesignTimeMethodInfo addMethod = null;
private DesignTimeMethodInfo removeMethod = null;
private Attribute[] attributes = null;
private MemberAttributes memberAttributes;
private DesignTimeType declaringType;
private CodeMemberEvent codeDomEvent;
internal DesignTimeEventInfo(DesignTimeType declaringType, CodeMemberEvent codeDomEvent)
{
if (declaringType == null)
{
throw new ArgumentNullException("Declaring Type");
}
if (codeDomEvent == null)
{
throw new ArgumentNullException("codeDomEvent");
}
this.declaringType = declaringType;
this.codeDomEvent = codeDomEvent;
this.name = Helper.EnsureTypeName(codeDomEvent.Name);
this.memberAttributes = codeDomEvent.Attributes;
this.addMethod = null;
this.removeMethod = null;
}
#endregion
#region Event Info overrides
public override MethodInfo GetAddMethod(bool nonPublic)
{
if (this.addMethod == null)
{
Type handlerType = declaringType.ResolveType(DesignTimeType.GetTypeNameFromCodeTypeReference(this.codeDomEvent.Type, declaringType));
if (handlerType != null)
{
CodeMemberMethod codeAddMethod = new CodeMemberMethod();
codeAddMethod.Name = "add_" + this.name;
codeAddMethod.ReturnType = new CodeTypeReference(typeof(void));
codeAddMethod.Parameters.Add(new CodeParameterDeclarationExpression(this.codeDomEvent.Type, "Handler"));
codeAddMethod.Attributes = this.memberAttributes;
this.addMethod = new DesignTimeMethodInfo(this.declaringType, codeAddMethod, true);
}
}
return this.addMethod;
}
public override MethodInfo GetRemoveMethod(bool nonPublic)
{
if (this.removeMethod == null)
{
Type handlerType = declaringType.ResolveType(DesignTimeType.GetTypeNameFromCodeTypeReference(this.codeDomEvent.Type, declaringType));
if (handlerType != null)
{
CodeMemberMethod codeRemoveMethod = new CodeMemberMethod();
codeRemoveMethod.Name = "remove_" + this.name;
codeRemoveMethod.ReturnType = new CodeTypeReference(typeof(void));
codeRemoveMethod.Parameters.Add(new CodeParameterDeclarationExpression(handlerType, "Handler"));
codeRemoveMethod.Attributes = this.memberAttributes;
this.removeMethod = new DesignTimeMethodInfo(declaringType, codeRemoveMethod, true);
}
}
return this.removeMethod;
}
public override MethodInfo GetRaiseMethod(bool nonPublic)
{
return null;
}
public override EventAttributes Attributes
{
//We're not interested in this flag
get
{
return default(EventAttributes);
}
}
#endregion
#region MemberInfo Overrides
public override string Name
{
get
{
return this.name;
}
}
public override Type DeclaringType
{
get
{
return this.declaringType;
}
}
public override Type ReflectedType
{
get
{
return this.declaringType;
}
}
public override object[] GetCustomAttributes(bool inherit)
{
return GetCustomAttributes(typeof(object), inherit);
}
public override object[] GetCustomAttributes(Type attributeType, bool inherit)
{
if (attributeType == null)
throw new ArgumentNullException("attributeType");
if (this.attributes == null)
this.attributes = Helper.LoadCustomAttributes(this.codeDomEvent.CustomAttributes, this.DeclaringType as DesignTimeType);
return Helper.GetCustomAttributes(attributeType, inherit, this.attributes, this);
}
public override bool IsDefined(Type attributeType, bool inherit)
{
if (attributeType == null)
throw new ArgumentNullException("attributeType");
if (this.attributes == null)
this.attributes = Helper.LoadCustomAttributes(this.codeDomEvent.CustomAttributes, this.DeclaringType as DesignTimeType);
if (Helper.IsDefined(attributeType, inherit, attributes, this))
return true;
return false;
}
#endregion
#region Helpers
internal bool IsPublic
{
get
{
return ((memberAttributes & MemberAttributes.Public) != 0);
}
}
internal bool IsStatic
{
get
{
return ((memberAttributes & MemberAttributes.Static) != 0);
}
}
#endregion
}
#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
- IdentityReference.cs
- NavigationCommands.cs
- SerialStream.cs
- WebPartDisplayModeEventArgs.cs
- Vector3D.cs
- SettingsContext.cs
- HtmlForm.cs
- Panel.cs
- DataBindingHandlerAttribute.cs
- COM2FontConverter.cs
- XmlTextReader.cs
- ScriptManager.cs
- KerberosSecurityTokenProvider.cs
- XmlObjectSerializerReadContextComplex.cs
- Rotation3D.cs
- TypedTableBaseExtensions.cs
- ThreadInterruptedException.cs
- HashSetEqualityComparer.cs
- PriorityBinding.cs
- Propagator.cs
- RadioButtonPopupAdapter.cs
- DomainConstraint.cs
- RightsManagementEncryptionTransform.cs
- DesignTimeParseData.cs
- TerminatorSinks.cs
- TypeKeyValue.cs
- securestring.cs
- ParameterReplacerVisitor.cs
- MenuItem.cs
- FormViewDeletedEventArgs.cs
- MenuScrollingVisibilityConverter.cs
- COMException.cs
- XmlArrayItemAttribute.cs
- clipboard.cs
- MetadataException.cs
- ConsoleKeyInfo.cs
- pingexception.cs
- LicenseContext.cs
- storepermissionattribute.cs
- PortCache.cs
- listitem.cs
- SelectionList.cs
- ListViewItemEventArgs.cs
- CodeCatchClause.cs
- XamlStyleSerializer.cs
- WebPartDisplayMode.cs
- Vars.cs
- DesignTimeParseData.cs
- CodeAccessPermission.cs
- ParserOptions.cs
- SecurityTraceRecordHelper.cs
- StructuralType.cs
- DesignerActionList.cs
- CompositeCollection.cs
- ObjectAssociationEndMapping.cs
- ValidateNames.cs
- KeyboardNavigation.cs
- Point3DCollection.cs
- XmlSchemaInfo.cs
- NullableDecimalAverageAggregationOperator.cs
- Int16KeyFrameCollection.cs
- TableCellCollection.cs
- DiffuseMaterial.cs
- RawTextInputReport.cs
- FixedSOMPage.cs
- FirewallWrapper.cs
- SqlConnectionHelper.cs
- ArgumentNullException.cs
- InkCanvasSelectionAdorner.cs
- _AcceptOverlappedAsyncResult.cs
- ReturnType.cs
- DelegateSerializationHolder.cs
- DrawingAttributesDefaultValueFactory.cs
- FolderBrowserDialog.cs
- UnsafeNativeMethods.cs
- XPathSelfQuery.cs
- TripleDES.cs
- ByeMessageCD1.cs
- SRDisplayNameAttribute.cs
- RijndaelManaged.cs
- SQLDateTimeStorage.cs
- DependencyObject.cs
- InstanceOwner.cs
- AddToCollection.cs
- XmlSchemaComplexContent.cs
- CryptoApi.cs
- precedingsibling.cs
- EncoderReplacementFallback.cs
- DataAdapter.cs
- Ipv6Element.cs
- TextEditorCharacters.cs
- MachineKeySection.cs
- ViewSimplifier.cs
- HttpResponseHeader.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- PerformanceCounterCategory.cs
- TextDecorationLocationValidation.cs
- XmlReflectionImporter.cs
- recordstatescratchpad.cs
- ConstructorNeedsTagAttribute.cs