Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / NativeActivityMetadata.cs / 1305376 / NativeActivityMetadata.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.Activities { using System; using System.Activities.Validation; using System.Collections.ObjectModel; public struct NativeActivityMetadata { Activity activity; LocationReferenceEnvironment environment; bool createEmptyBindings; internal NativeActivityMetadata(Activity activity, LocationReferenceEnvironment environment, bool createEmptyBindings) { this.activity = activity; this.environment = environment; this.createEmptyBindings = createEmptyBindings; } internal bool CreateEmptyBindings { get { return this.createEmptyBindings; } } public LocationReferenceEnvironment Environment { get { return this.environment; } } public bool HasViolations { get { if (this.activity == null) { return false; } else { return this.activity.HasTempViolations; } } } public static bool operator ==(NativeActivityMetadata left, NativeActivityMetadata right) { return left.Equals(right); } public static bool operator !=(NativeActivityMetadata left, NativeActivityMetadata right) { return !left.Equals(right); } public override bool Equals(object obj) { if (!(obj is NativeActivityMetadata)) { return false; } NativeActivityMetadata other = (NativeActivityMetadata)obj; return other.activity == this.activity && other.Environment == this.Environment && other.CreateEmptyBindings == this.CreateEmptyBindings; } public override int GetHashCode() { if (this.activity == null) { return 0; } else { return this.activity.GetHashCode(); } } public void Bind(Argument binding, RuntimeArgument argument) { ThrowIfDisposed(); Argument.TryBind(binding, argument, this.activity); } public void SetValidationErrorsCollection(CollectionvalidationErrors) { ThrowIfDisposed(); ActivityUtilities.RemoveNulls(validationErrors); this.activity.SetTempValidationErrorCollection(validationErrors); } public void AddValidationError(string validationErrorMessage) { AddValidationError(new ValidationError(validationErrorMessage)); } public void AddValidationError(ValidationError validationError) { ThrowIfDisposed(); if (validationError != null) { this.activity.AddTempValidationError(validationError); } } public void SetArgumentsCollection(Collection arguments) { ThrowIfDisposed(); ActivityUtilities.RemoveNulls(arguments); this.activity.SetArgumentsCollection(arguments, this.createEmptyBindings); } public void AddArgument(RuntimeArgument argument) { ThrowIfDisposed(); if (argument != null) { this.activity.AddArgument(argument, this.createEmptyBindings); } } public void SetChildrenCollection(Collection children) { ThrowIfDisposed(); ActivityUtilities.RemoveNulls(children); this.activity.SetChildrenCollection(children); } public void AddChild(Activity child) { ThrowIfDisposed(); if (child != null) { this.activity.AddChild(child); } } public void SetImplementationChildrenCollection(Collection implementationChildren) { ThrowIfDisposed(); ActivityUtilities.RemoveNulls(implementationChildren); this.activity.SetImplementationChildrenCollection(implementationChildren); } public void AddImplementationChild(Activity implementationChild) { ThrowIfDisposed(); if (implementationChild != null) { this.activity.AddImplementationChild(implementationChild); } } public void SetImportedChildrenCollection(Collection importedChildren) { ThrowIfDisposed(); ActivityUtilities.RemoveNulls(importedChildren); this.activity.SetImportedChildrenCollection(importedChildren); } public void AddImportedChild(Activity importedChild) { ThrowIfDisposed(); if (importedChild != null) { this.activity.AddImportedChild(importedChild); } } public void SetDelegatesCollection(Collection delegates) { ThrowIfDisposed(); ActivityUtilities.RemoveNulls(delegates); this.activity.SetDelegatesCollection(delegates); } public void AddDelegate(ActivityDelegate activityDelegate) { ThrowIfDisposed(); if (activityDelegate != null) { this.activity.AddDelegate(activityDelegate); } } public void SetImplementationDelegatesCollection(Collection implementationDelegates) { ThrowIfDisposed(); ActivityUtilities.RemoveNulls(implementationDelegates); this.activity.SetImplementationDelegatesCollection(implementationDelegates); } public void AddImplementationDelegate(ActivityDelegate implementationDelegate) { ThrowIfDisposed(); if (implementationDelegate != null) { this.activity.AddImplementationDelegate(implementationDelegate); } } public void SetImportedDelegatesCollection(Collection importedDelegates) { ThrowIfDisposed(); ActivityUtilities.RemoveNulls(importedDelegates); this.activity.SetImportedDelegatesCollection(importedDelegates); } public void AddImportedDelegate(ActivityDelegate importedDelegate) { ThrowIfDisposed(); if (importedDelegate != null) { this.activity.AddImportedDelegate(importedDelegate); } } public void SetVariablesCollection(Collection variables) { ThrowIfDisposed(); ActivityUtilities.RemoveNulls(variables); this.activity.SetVariablesCollection(variables); } public void AddVariable(Variable variable) { ThrowIfDisposed(); if (variable != null) { this.activity.AddVariable(variable); } } public void SetImplementationVariablesCollection(Collection implementationVariables) { ThrowIfDisposed(); ActivityUtilities.RemoveNulls(implementationVariables); this.activity.SetImplementationVariablesCollection(implementationVariables); } public void AddImplementationVariable(Variable implementationVariable) { ThrowIfDisposed(); if (implementationVariable != null) { this.activity.AddImplementationVariable(implementationVariable); } } public Collection GetArgumentsWithReflection() { return Activity.ReflectedInformation.GetArguments(this.activity); } public Collection GetChildrenWithReflection() { return Activity.ReflectedInformation.GetChildren(this.activity); } public Collection GetVariablesWithReflection() { return Activity.ReflectedInformation.GetVariables(this.activity); } public Collection GetDelegatesWithReflection() { return Activity.ReflectedInformation.GetDelegates(this.activity); } public void AddDefaultExtensionProvider (Func extensionProvider) where T : class { if (extensionProvider == null) { throw FxTrace.Exception.ArgumentNull("extensionProvider"); } this.activity.AddDefaultExtensionProvider(extensionProvider); } public void RequireExtension () where T : class { this.activity.RequireExtension(typeof(T)); } public void RequireExtension(Type extensionType) { if (extensionType == null) { throw FxTrace.Exception.ArgumentNull("extensionType"); } if (extensionType.IsValueType) { throw FxTrace.Exception.Argument("extensionType", SR.RequireExtensionOnlyAcceptsReferenceTypes(extensionType.FullName)); } this.activity.RequireExtension(extensionType); } internal void Dispose() { this.activity = null; } void ThrowIfDisposed() { if (this.activity == null) { throw FxTrace.Exception.AsError(new ObjectDisposedException(ToString())); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HostedAspNetEnvironment.cs
- DocumentViewer.cs
- LoginName.cs
- XmlNotation.cs
- CodeMemberField.cs
- dsa.cs
- Grammar.cs
- Debugger.cs
- ObjectItemLoadingSessionData.cs
- BrowserTree.cs
- EventLogException.cs
- SecurityResources.cs
- DrawListViewSubItemEventArgs.cs
- FileDetails.cs
- UnmanagedMemoryStreamWrapper.cs
- PointCollectionValueSerializer.cs
- QilIterator.cs
- ServiceProviders.cs
- SemanticResolver.cs
- GCHandleCookieTable.cs
- Misc.cs
- CodeThrowExceptionStatement.cs
- NavigationPropertyEmitter.cs
- ScanQueryOperator.cs
- FunctionDetailsReader.cs
- XmlNamespaceManager.cs
- FileNotFoundException.cs
- DataObjectCopyingEventArgs.cs
- ConstructorArgumentAttribute.cs
- DataPagerCommandEventArgs.cs
- PartialArray.cs
- SqlBuffer.cs
- LocalizableResourceBuilder.cs
- Panel.cs
- XmlCodeExporter.cs
- MethodImplAttribute.cs
- SqlNotificationRequest.cs
- JumpPath.cs
- FixedSOMFixedBlock.cs
- CodeDelegateInvokeExpression.cs
- Compilation.cs
- Encoding.cs
- StyleModeStack.cs
- Matrix.cs
- XmlNotation.cs
- WebPartDisplayModeCancelEventArgs.cs
- WorkflowOperationBehavior.cs
- MenuCommand.cs
- RotateTransform.cs
- Span.cs
- SqlDependency.cs
- remotingproxy.cs
- Label.cs
- EntityDataSourceWizardForm.cs
- AmbientEnvironment.cs
- ISFTagAndGuidCache.cs
- ListViewEditEventArgs.cs
- validation.cs
- SettingsPropertyIsReadOnlyException.cs
- Command.cs
- TextContainerChangedEventArgs.cs
- SqlFunctions.cs
- AspCompat.cs
- LinqDataSourceContextEventArgs.cs
- cookiecollection.cs
- DesignerProperties.cs
- Int16KeyFrameCollection.cs
- BaseTemplateParser.cs
- Speller.cs
- UIElementParaClient.cs
- SymbolPair.cs
- XmlElement.cs
- StorageEntityTypeMapping.cs
- EventListenerClientSide.cs
- EditorPart.cs
- XmlCharacterData.cs
- TypeLoader.cs
- TypeConverterAttribute.cs
- Expressions.cs
- ExpandoClass.cs
- DataObjectFieldAttribute.cs
- SimpleWebHandlerParser.cs
- WebPartZone.cs
- MD5CryptoServiceProvider.cs
- WsiProfilesElementCollection.cs
- ArrayItemValue.cs
- NamedPipeTransportElement.cs
- AutoGeneratedField.cs
- XmlWriterTraceListener.cs
- XsltLibrary.cs
- GetCryptoTransformRequest.cs
- UnaryOperationBinder.cs
- BitmapEffectGroup.cs
- SqlRecordBuffer.cs
- OperationInvokerBehavior.cs
- ShowExpandedMultiValueConverter.cs
- CapacityStreamGeometryContext.cs
- DataGridViewCellStyleBuilderDialog.cs
- HebrewNumber.cs
- CommonProperties.cs