You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@ -0,0 +1,69 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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 ArgumentReference<T> : EnvironmentLocationReference<T>
|
||||
{
|
||||
RuntimeArgument targetArgument;
|
||||
|
||||
public ArgumentReference()
|
||||
{
|
||||
}
|
||||
|
||||
public ArgumentReference(string argumentName)
|
||||
{
|
||||
this.ArgumentName = argumentName;
|
||||
}
|
||||
|
||||
public string ArgumentName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public override LocationReference LocationReference
|
||||
{
|
||||
get { return this.targetArgument; }
|
||||
}
|
||||
|
||||
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 (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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user