Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Expressions / DelegateArgumentValue.cs / 1305376 / DelegateArgumentValue.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.Activities.Expressions
{
using System.Linq.Expressions;
using System.Runtime;
using System.Windows.Markup;
[ContentProperty("DelegateArgument")]
public sealed class DelegateArgumentValue : CodeActivity, IExpressionContainer
{
public DelegateArgumentValue()
: base()
{
}
public DelegateArgumentValue(DelegateArgument delegateArgument)
: this()
{
this.DelegateArgument = delegateArgument;
}
public DelegateArgument DelegateArgument
{
get;
set;
}
Expression IExpressionContainer.Expression
{
get
{
return ExpressionUtilities.CreateIdentifierExpression(this.DelegateArgument);
}
}
protected override void CacheMetadata(CodeActivityMetadata metadata)
{
if (this.DelegateArgument == null)
{
metadata.AddValidationError(SR.DelegateArgumentMustBeSet);
}
else
{
if (!this.DelegateArgument.IsInTree)
{
metadata.AddValidationError(SR.DelegateArgumentMustBeReferenced(this.DelegateArgument.Name));
}
if (!metadata.Environment.IsVisible(this.DelegateArgument))
{
metadata.AddValidationError(SR.DelegateArgumentNotVisible(this.DelegateArgument.Name));
}
if (!(this.DelegateArgument is DelegateInArgument) && !TypeHelper.AreTypesCompatible(this.DelegateArgument.Type, typeof(T)))
{
metadata.AddValidationError(SR.DelegateArgumentTypeInvalid(this.DelegateArgument, typeof(T), this.DelegateArgument.Type));
}
}
}
internal override bool TryGetValue(ActivityContext context, out T value)
{
try
{
context.AllowChainedEnvironmentAccess = true;
value = context.GetValue((LocationReference)this.DelegateArgument);
}
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
- InvalidMessageContractException.cs
- RecognizedPhrase.cs
- DynamicMethod.cs
- EncoderReplacementFallback.cs
- PolicyException.cs
- WebExceptionStatus.cs
- SplineKeyFrames.cs
- PkcsUtils.cs
- MetaData.cs
- WorkflowLayouts.cs
- TCEAdapterGenerator.cs
- EntityViewGenerator.cs
- AutomationFocusChangedEventArgs.cs
- MetadataArtifactLoaderCompositeResource.cs
- Tablet.cs
- DataGridColumnHeadersPresenter.cs
- ExpressionUtilities.cs
- cookieexception.cs
- RuleSettingsCollection.cs
- UpdateCompiler.cs
- PolicyManager.cs
- ISAPIRuntime.cs
- DbMetaDataFactory.cs
- AnnotationAuthorChangedEventArgs.cs
- MediaElementAutomationPeer.cs
- XmlEnumAttribute.cs
- SqlServer2KCompatibilityAnnotation.cs
- AttributeProviderAttribute.cs
- BinaryNode.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- TimelineCollection.cs
- MD5CryptoServiceProvider.cs
- MsmqIntegrationBindingElement.cs
- XPathAncestorIterator.cs
- MimeMapping.cs
- CryptoConfig.cs
- VirtualDirectoryMappingCollection.cs
- _SSPIWrapper.cs
- ObfuscationAttribute.cs
- CompiledRegexRunner.cs
- DriveNotFoundException.cs
- ObjectResult.cs
- DecoderReplacementFallback.cs
- SapiRecognizer.cs
- CapabilitiesPattern.cs
- SimpleLine.cs
- ImmComposition.cs
- ChtmlFormAdapter.cs
- PerformanceCounterManager.cs
- ProgressBarHighlightConverter.cs
- ListBoxItem.cs
- LicenseException.cs
- LowerCaseStringConverter.cs
- Timer.cs
- AspProxy.cs
- AttachmentService.cs
- AccessorTable.cs
- ExtensionFile.cs
- TypeInitializationException.cs
- WebProxyScriptElement.cs
- Rotation3DAnimationUsingKeyFrames.cs
- MimeObjectFactory.cs
- FrameworkElementAutomationPeer.cs
- VisualProxy.cs
- ScriptReferenceBase.cs
- SpotLight.cs
- FrameworkReadOnlyPropertyMetadata.cs
- MethodBuilderInstantiation.cs
- RijndaelManaged.cs
- MailHeaderInfo.cs
- LogAppendAsyncResult.cs
- QueryGeneratorBase.cs
- FaultImportOptions.cs
- LocalizabilityAttribute.cs
- SqlInfoMessageEvent.cs
- ProxyAttribute.cs
- PlanCompiler.cs
- OracleBFile.cs
- Nullable.cs
- TextParagraphProperties.cs
- OleDbRowUpdatingEvent.cs
- SizeIndependentAnimationStorage.cs
- Int32AnimationBase.cs
- ComponentSerializationService.cs
- EmbeddedMailObject.cs
- DbDataReader.cs
- OdbcDataReader.cs
- MemberDescriptor.cs
- StrokeRenderer.cs
- TextDecorationCollection.cs
- SecurityTokenAuthenticator.cs
- SelfIssuedSamlTokenFactory.cs
- SymmetricSecurityProtocol.cs
- MenuItemStyleCollection.cs
- UrlPath.cs
- FloatMinMaxAggregationOperator.cs
- GenericIdentity.cs
- AspNetHostingPermission.cs
- XPathExpr.cs
- CommandValueSerializer.cs