Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Expressions / ArgumentValue.cs / 1305376 / ArgumentValue.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Activities.Expressions { using System.Collections.Generic; using System.Linq.Expressions; using System.Runtime; using System.Windows.Markup; public sealed class ArgumentValue: CodeActivity { RuntimeArgument targetArgument; public ArgumentValue() { } public ArgumentValue(string argumentName) { this.ArgumentName = argumentName; } public string ArgumentName { get; set; } protected override void CacheMetadata(CodeActivityMetadata metadata) { this.targetArgument = null; if (string.IsNullOrEmpty(this.ArgumentName)) { metadata.AddValidationError(SR.ArgumentNameRequired); } else { this.targetArgument = ActivityUtilities.FindArgument(this.ArgumentName, this); if (this.targetArgument == null) { metadata.AddValidationError(SR.ArgumentNotFound(this.ArgumentName)); } else if (!TypeHelper.AreTypesCompatible(this.targetArgument.Type, typeof(T))) { metadata.AddValidationError(SR.ArgumentTypeMustBeCompatible(this.ArgumentName, this.targetArgument.Type, typeof(T))); } } } public override string ToString() { if (!string.IsNullOrEmpty(this.ArgumentName)) { return this.ArgumentName; } return base.ToString(); } internal override bool TryGetValue(ActivityContext context, out T value) { if (this.targetArgument == null) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.UnopenedActivitiesCannotBeExecuted(this.DisplayName))); } try { context.AllowChainedEnvironmentAccess = true; value = context.GetValue (this.targetArgument); } finally { context.AllowChainedEnvironmentAccess = false; } return true; } protected override T Execute(CodeActivityContext context) { return ExecuteWithTryGetValue(context); } } } // 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
- DrawTreeNodeEventArgs.cs
- MaterialCollection.cs
- Exceptions.cs
- SqlXml.cs
- NameValueCollection.cs
- TransformedBitmap.cs
- UInt32.cs
- HtmlShimManager.cs
- Opcode.cs
- counter.cs
- CodePageUtils.cs
- TextParagraphProperties.cs
- SHA256Managed.cs
- PropertyInfoSet.cs
- RemoteWebConfigurationHost.cs
- Pts.cs
- SecurityContextCookieSerializer.cs
- StringSorter.cs
- StrongNamePublicKeyBlob.cs
- DesignerActionTextItem.cs
- securitycriticaldata.cs
- XsltSettings.cs
- SystemResourceKey.cs
- SimpleApplicationHost.cs
- DataListItemEventArgs.cs
- PaintEvent.cs
- FrameworkElementFactoryMarkupObject.cs
- XmlArrayItemAttributes.cs
- CustomErrorsSectionWrapper.cs
- SectionUpdates.cs
- ActivityCollectionMarkupSerializer.cs
- IProvider.cs
- Properties.cs
- StateMachineHelpers.cs
- PropertyValueChangedEvent.cs
- DefaultExpressionVisitor.cs
- CalculatedColumn.cs
- TransformCryptoHandle.cs
- InkCanvas.cs
- ProfileSection.cs
- UnsafeNetInfoNativeMethods.cs
- ExpressionVisitorHelpers.cs
- WorkItem.cs
- AnnouncementEventArgs.cs
- TagNameToTypeMapper.cs
- TableLayoutPanel.cs
- ProviderException.cs
- COM2ColorConverter.cs
- GraphicsContainer.cs
- XmlILIndex.cs
- WebPartZoneBase.cs
- Ports.cs
- Rfc2898DeriveBytes.cs
- ProtocolElement.cs
- DbDeleteCommandTree.cs
- RegexGroupCollection.cs
- WebPartRestoreVerb.cs
- DataGridViewButtonCell.cs
- SqlCommandSet.cs
- DesignerForm.cs
- TypefaceMetricsCache.cs
- _ListenerRequestStream.cs
- Emitter.cs
- DataGridViewRowStateChangedEventArgs.cs
- Icon.cs
- WorkItem.cs
- ClientScriptManagerWrapper.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- NameValueCollection.cs
- CustomCredentialPolicy.cs
- VoiceObjectToken.cs
- ProfilePropertyNameValidator.cs
- DefaultBinder.cs
- SQLDateTimeStorage.cs
- Soap12ProtocolReflector.cs
- QuaternionAnimationBase.cs
- StringArrayConverter.cs
- PartialArray.cs
- DataError.cs
- LinqDataSourceView.cs
- TrackBar.cs
- ImageFormat.cs
- Model3DGroup.cs
- CacheHelper.cs
- RelationshipDetailsRow.cs
- ReaderWriterLockWrapper.cs
- RegexParser.cs
- COM2Enum.cs
- CompositionTarget.cs
- TextServicesDisplayAttribute.cs
- Schema.cs
- FrameworkTemplate.cs
- sqlpipe.cs
- TraceListeners.cs
- TagMapCollection.cs
- SafeRightsManagementSessionHandle.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- Model3DCollection.cs
- SqlCacheDependencyDatabaseCollection.cs
- WindowsListViewItem.cs