Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / ActivityMetadata.cs / 1305376 / ActivityMetadata.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.Activities { using System; using System.Runtime; using System.Collections.ObjectModel; using System.Activities.Validation; public struct ActivityMetadata { Activity activity; LocationReferenceEnvironment environment; bool createEmptyBindings; internal ActivityMetadata(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 override bool Equals(object obj) { if (!(obj is ActivityMetadata)) { return false; } ActivityMetadata other = (ActivityMetadata)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 static bool operator ==(ActivityMetadata left, ActivityMetadata right) { return left.Equals(right); } public static bool operator !=(ActivityMetadata left, ActivityMetadata right) { return !left.Equals(right); } 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 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 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 Collection GetArgumentsWithReflection() { return Activity.ReflectedInformation.GetArguments(this.activity); } public Collection GetImportedChildrenWithReflection() { return Activity.ReflectedInformation.GetChildren(this.activity); } public Collection GetVariablesWithReflection() { return Activity.ReflectedInformation.GetVariables(this.activity); } public Collection GetImportedDelegatesWithReflection() { 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
- BadImageFormatException.cs
- UnionCodeGroup.cs
- DateTimeOffsetConverter.cs
- SessionStateModule.cs
- ReachUIElementCollectionSerializerAsync.cs
- DesignerTextViewAdapter.cs
- ObjectDataSourceWizardForm.cs
- CharacterBuffer.cs
- DataGridComponentEditor.cs
- DataGridViewCellStateChangedEventArgs.cs
- OleCmdHelper.cs
- IconBitmapDecoder.cs
- LocalizedNameDescriptionPair.cs
- HMACSHA1.cs
- StyleXamlParser.cs
- XmlSchemaValidator.cs
- DesignerProperties.cs
- IsolatedStorageFilePermission.cs
- QuotedStringWriteStateInfo.cs
- XamlBrushSerializer.cs
- HideDisabledControlAdapter.cs
- HttpChannelHelper.cs
- FrameSecurityDescriptor.cs
- HtmlElementCollection.cs
- EventManager.cs
- TextDpi.cs
- ByteAnimationBase.cs
- AnnotationAuthorChangedEventArgs.cs
- SubqueryRules.cs
- wgx_render.cs
- MutexSecurity.cs
- PathSegment.cs
- JsonCollectionDataContract.cs
- Trace.cs
- HtmlTextArea.cs
- UserUseLicenseDictionaryLoader.cs
- ProfilePropertyNameValidator.cs
- TextRangeBase.cs
- BlobPersonalizationState.cs
- QueryableFilterUserControl.cs
- EncoderBestFitFallback.cs
- SiteMapDataSourceDesigner.cs
- OdbcStatementHandle.cs
- HelpEvent.cs
- Evidence.cs
- EventHandlerService.cs
- UriParserTemplates.cs
- DeclaredTypeElement.cs
- LayoutSettings.cs
- BamlRecordReader.cs
- TiffBitmapEncoder.cs
- SharedStatics.cs
- RegexCode.cs
- Variable.cs
- Vector3DCollection.cs
- NamespaceList.cs
- AdRotator.cs
- XsdDataContractExporter.cs
- CryptoProvider.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- Button.cs
- MatchAttribute.cs
- IdleTimeoutMonitor.cs
- FilterElement.cs
- SHA256Managed.cs
- ErrorProvider.cs
- OpacityConverter.cs
- ResourceProviderFactory.cs
- TransportDefaults.cs
- ArrayWithOffset.cs
- OdbcConnection.cs
- EdmValidator.cs
- GridViewCancelEditEventArgs.cs
- AdRotator.cs
- Operand.cs
- ActiveDocumentEvent.cs
- ObjectListSelectEventArgs.cs
- AnonymousIdentificationSection.cs
- HyperLinkColumn.cs
- SizeChangedEventArgs.cs
- DataGridState.cs
- ImageIndexConverter.cs
- SafeCoTaskMem.cs
- _Connection.cs
- Enum.cs
- UrlEncodedParameterWriter.cs
- View.cs
- SplitterCancelEvent.cs
- VectorCollection.cs
- PrincipalPermission.cs
- OleDbStruct.cs
- SchemaNamespaceManager.cs
- FontNamesConverter.cs
- PtsHost.cs
- PinnedBufferMemoryStream.cs
- ObjectViewQueryResultData.cs
- XamlReader.cs
- BamlRecordReader.cs
- MenuTracker.cs
- NullableLongSumAggregationOperator.cs