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
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,198 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using Microsoft.VisualBasic.Activities;
|
||||
using System;
|
||||
using System.Activities.Expressions;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Markup;
|
||||
using System.Xaml;
|
||||
using System.Xaml.Schema;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.VisualBasic.Activities.XamlIntegration;
|
||||
|
||||
public sealed class ActivityWithResultConverter : TypeConverterBase
|
||||
{
|
||||
public ActivityWithResultConverter()
|
||||
: base(typeof(Activity<>), typeof(ExpressionConverterHelper<>))
|
||||
{
|
||||
}
|
||||
|
||||
public ActivityWithResultConverter(Type type)
|
||||
: base(type, typeof(Activity<>), typeof(ExpressionConverterHelper<>))
|
||||
{
|
||||
}
|
||||
|
||||
internal static object GetRootTemplatedActivity(IServiceProvider serviceProvider)
|
||||
{
|
||||
// For now, we only support references to the root Activity when we're inside an Activity.Body
|
||||
// Note that in the case of nested activity bodies, this gives us the outer activity
|
||||
IRootObjectProvider rootProvider =
|
||||
serviceProvider.GetService(typeof(IRootObjectProvider)) as IRootObjectProvider;
|
||||
if (rootProvider == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
IAmbientProvider ambientProvider =
|
||||
serviceProvider.GetService(typeof(IAmbientProvider)) as IAmbientProvider;
|
||||
if (ambientProvider == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
IXamlSchemaContextProvider schemaContextProvider =
|
||||
serviceProvider.GetService(typeof(IXamlSchemaContextProvider)) as IXamlSchemaContextProvider;
|
||||
if (schemaContextProvider == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
XamlMember activityBody = GetXamlMember(schemaContextProvider.SchemaContext, typeof(Activity), "Implementation");
|
||||
XamlMember dynamicActivityBody = GetXamlMember(schemaContextProvider.SchemaContext, typeof(DynamicActivity), "Implementation");
|
||||
if (activityBody == null || dynamicActivityBody == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (ambientProvider.GetFirstAmbientValue(null, activityBody, dynamicActivityBody) == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
object rootActivity = rootProvider.RootObject as Activity;
|
||||
return rootActivity;
|
||||
}
|
||||
|
||||
static XamlMember GetXamlMember(XamlSchemaContext schemaContext, Type type, string memberName)
|
||||
{
|
||||
XamlType xamlType = schemaContext.GetXamlType(type);
|
||||
if (xamlType == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
XamlMember xamlMember = xamlType.GetMember(memberName);
|
||||
return xamlMember;
|
||||
}
|
||||
|
||||
internal sealed class ExpressionConverterHelper<T> : TypeConverterHelper<Activity<T>>
|
||||
{
|
||||
static Regex LiteralEscapeRegex = new Regex(@"^(%+\[)");
|
||||
static Type LocationHelperType = typeof(LocationHelper<>);
|
||||
|
||||
TypeConverter baseConverter;
|
||||
Type valueType;
|
||||
LocationHelper locationHelper; // true if we're dealing with a Location
|
||||
|
||||
public ExpressionConverterHelper()
|
||||
: this(TypeHelper.AreTypesCompatible(typeof(T), typeof(Location)))
|
||||
{
|
||||
}
|
||||
|
||||
public ExpressionConverterHelper(bool isLocationType)
|
||||
{
|
||||
this.valueType = typeof(T);
|
||||
|
||||
if (isLocationType)
|
||||
{
|
||||
Fx.Assert(this.valueType.IsGenericType && this.valueType.GetGenericArguments().Length == 1, "Should only get Location<T> here");
|
||||
this.valueType = this.valueType.GetGenericArguments()[0];
|
||||
Type concreteHelperType = LocationHelperType.MakeGenericType(typeof(T), this.valueType);
|
||||
this.locationHelper = (LocationHelper)Activator.CreateInstance(concreteHelperType);
|
||||
}
|
||||
}
|
||||
|
||||
TypeConverter BaseConverter
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.baseConverter == null)
|
||||
{
|
||||
this.baseConverter = TypeDescriptor.GetConverter(this.valueType);
|
||||
}
|
||||
|
||||
return this.baseConverter;
|
||||
}
|
||||
}
|
||||
|
||||
public override Activity<T> ConvertFromString(string text, ITypeDescriptorContext context)
|
||||
{
|
||||
if (IsExpression(text))
|
||||
{
|
||||
// Expression. Use the expression parser.
|
||||
string expressionText = text.Substring(1, text.Length - 2);
|
||||
|
||||
if (this.locationHelper != null)
|
||||
{
|
||||
//
|
||||
return (Activity<T>)this.locationHelper.CreateExpression(expressionText);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
return new VisualBasicValue<T>()
|
||||
{
|
||||
ExpressionText = expressionText
|
||||
};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.locationHelper != null)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SR.InvalidLocationExpression));
|
||||
}
|
||||
|
||||
// look for "%[....]" escape pattern
|
||||
if (text.EndsWith("]", StringComparison.Ordinal) && LiteralEscapeRegex.IsMatch(text))
|
||||
{
|
||||
// strip off the very front-most '%' from the original string
|
||||
text = text.Substring(1, text.Length - 1);
|
||||
}
|
||||
|
||||
T literalValue;
|
||||
if (text is T)
|
||||
{
|
||||
literalValue = (T)(object)text;
|
||||
}
|
||||
else if (text == string.Empty) // workaround for System.Runtime.Xaml bug
|
||||
{
|
||||
literalValue = default(T);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Literal value. Invoke the base type converter.
|
||||
literalValue = (T)BaseConverter.ConvertFromString(context, text);
|
||||
}
|
||||
|
||||
return new Literal<T> { Value = literalValue };
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsExpression(string text)
|
||||
{
|
||||
return (text.StartsWith("[", StringComparison.Ordinal) && text.EndsWith("]", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
// to perform the generics dance around Locations we need these helpers
|
||||
abstract class LocationHelper
|
||||
{
|
||||
public abstract Activity CreateExpression(string expressionText);
|
||||
}
|
||||
|
||||
class LocationHelper<TLocationValue> : LocationHelper
|
||||
{
|
||||
public override Activity CreateExpression(string expressionText)
|
||||
{
|
||||
return new VisualBasicReference<TLocationValue>()
|
||||
{
|
||||
ExpressionText = expressionText
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Markup;
|
||||
using System.Xaml;
|
||||
|
||||
public sealed class ActivityWithResultValueSerializer : ValueSerializer
|
||||
{
|
||||
static ActivityWithResultValueSerializer valueSerializer;
|
||||
|
||||
public override bool CanConvertToString(object value, IValueSerializerContext context)
|
||||
{
|
||||
if (AttachablePropertyServices.GetAttachedPropertyCount(value) > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (value != null &&
|
||||
value is IValueSerializableExpression &&
|
||||
((IValueSerializableExpression)value).CanConvertToString(context))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override string ConvertToString(object value, IValueSerializerContext context)
|
||||
{
|
||||
IValueSerializableExpression ivsExpr;
|
||||
|
||||
ivsExpr = value as IValueSerializableExpression;
|
||||
if (ivsExpr == null)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SR.CannotSerializeExpression(value.GetType())));
|
||||
}
|
||||
return ivsExpr.ConvertToString(context);
|
||||
}
|
||||
|
||||
internal static bool CanConvertToStringWrapper(object value, IValueSerializerContext context)
|
||||
{
|
||||
if (valueSerializer == null)
|
||||
{
|
||||
valueSerializer = new ActivityWithResultValueSerializer();
|
||||
}
|
||||
|
||||
return valueSerializer.CanConvertToString(value, context);
|
||||
}
|
||||
|
||||
internal static string ConvertToStringWrapper(object value, IValueSerializerContext context)
|
||||
{
|
||||
if (valueSerializer == null)
|
||||
{
|
||||
valueSerializer = new ActivityWithResultValueSerializer();
|
||||
}
|
||||
|
||||
return valueSerializer.ConvertToString(value, context);
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System;
|
||||
|
||||
public class ActivityXamlServicesSettings
|
||||
{
|
||||
public bool CompileExpressions
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public LocationReferenceEnvironment LocationReferenceEnvironment
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Markup;
|
||||
|
||||
public class ArgumentValueSerializer : ValueSerializer
|
||||
{
|
||||
public override bool CanConvertToString(object value, IValueSerializerContext context)
|
||||
{
|
||||
Argument argument = value as Argument;
|
||||
if (argument == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (ActivityBuilder.HasPropertyReferences(value))
|
||||
{
|
||||
// won't be able to attach the property references if we convert to string
|
||||
return false;
|
||||
}
|
||||
|
||||
return argument.CanConvertToString(context);
|
||||
}
|
||||
|
||||
public override string ConvertToString(object value, IValueSerializerContext context)
|
||||
{
|
||||
Argument argument = value as Argument;
|
||||
if (argument == null)
|
||||
{
|
||||
// expect CanConvertToString() always comes before ConvertToString()
|
||||
throw FxTrace.Exception.Argument("value", SR.CannotSerializeExpression(value.GetType()));
|
||||
}
|
||||
|
||||
return argument.ConvertToString(context);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,113 @@
|
||||
// <copyright>
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System;
|
||||
using System.Activities.Expressions;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Xaml;
|
||||
|
||||
public class AssemblyReferenceConverter : TypeConverter
|
||||
{
|
||||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
|
||||
{
|
||||
return sourceType == typeof(string);
|
||||
}
|
||||
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
string stringValue = value as string;
|
||||
if (stringValue != null)
|
||||
{
|
||||
AssemblyReference result = new AssemblyReference
|
||||
{
|
||||
AssemblyName = new AssemblyName(stringValue)
|
||||
};
|
||||
|
||||
XamlSchemaContext schemaContext = GetSchemaContext(context);
|
||||
if (schemaContext != null &&
|
||||
schemaContext.ReferenceAssemblies != null &&
|
||||
schemaContext.ReferenceAssemblies.Count > 0)
|
||||
{
|
||||
Assembly assembly = ResolveAssembly(result.AssemblyName, schemaContext.ReferenceAssemblies);
|
||||
if (assembly != null)
|
||||
{
|
||||
result.Assembly = assembly;
|
||||
}
|
||||
else
|
||||
{
|
||||
// SchemaContext.ReferenceAssemblies is an exclusive list.
|
||||
// Disallow referencing assemblies that are not included in the list.
|
||||
result = null;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
|
||||
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
|
||||
{
|
||||
return destinationType == typeof(string);
|
||||
}
|
||||
|
||||
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
AssemblyReference reference = value as AssemblyReference;
|
||||
if (destinationType == typeof(string) && reference != null)
|
||||
{
|
||||
if (reference.AssemblyName != null)
|
||||
{
|
||||
return reference.AssemblyName.ToString();
|
||||
}
|
||||
else if (reference.Assembly != null)
|
||||
{
|
||||
XamlSchemaContext schemaContext = GetSchemaContext(context);
|
||||
if (schemaContext == null || schemaContext.FullyQualifyAssemblyNamesInClrNamespaces)
|
||||
{
|
||||
return reference.Assembly.FullName;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssemblyName assemblyName = AssemblyReference.GetFastAssemblyName(reference.Assembly);
|
||||
return assemblyName.Name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return base.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
|
||||
private static XamlSchemaContext GetSchemaContext(ITypeDescriptorContext context)
|
||||
{
|
||||
IXamlSchemaContextProvider provider = context.GetService(typeof(IXamlSchemaContextProvider)) as IXamlSchemaContextProvider;
|
||||
return provider != null ? provider.SchemaContext : null;
|
||||
}
|
||||
|
||||
private static Assembly ResolveAssembly(AssemblyName assemblyReference, IEnumerable<Assembly> assemblies)
|
||||
{
|
||||
foreach (Assembly assembly in assemblies)
|
||||
{
|
||||
AssemblyName assemblyName = AssemblyReference.GetFastAssemblyName(assembly);
|
||||
if (AssemblyReference.AssemblySatisfiesReference(assemblyName, assemblyReference))
|
||||
{
|
||||
return assembly;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,327 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System;
|
||||
using System.Activities;
|
||||
using System.Activities.Expressions;
|
||||
using System.Activities.Runtime;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime;
|
||||
|
||||
public abstract class CompiledDataContext
|
||||
{
|
||||
IList<Location> locations;
|
||||
IList<LocationReference> locationReferences;
|
||||
ExpressionTreeRewriter visitor;
|
||||
|
||||
[SuppressMessage(FxCop.Category.Usage, FxCop.Rule.DoNotCallOverridableMethodsInConstructors, Justification = "Derived classes are always generated code")]
|
||||
protected CompiledDataContext(IList<LocationReference> locationReferences, ActivityContext activityContext)
|
||||
{
|
||||
this.locationReferences = locationReferences;
|
||||
|
||||
if (this.locationReferences == null)
|
||||
{
|
||||
this.locationReferences = new List<LocationReference>();
|
||||
}
|
||||
|
||||
this.locations = ConvertReferences(this.locationReferences, activityContext);
|
||||
}
|
||||
|
||||
protected CompiledDataContext(IList<Location> locations)
|
||||
{
|
||||
this.locations = locations;
|
||||
}
|
||||
|
||||
protected CompiledDataContext(IList<LocationReference> locationReferences)
|
||||
{
|
||||
this.visitor = new ExpressionTreeRewriter(locationReferences);
|
||||
}
|
||||
|
||||
protected object GetVariableValue(int index)
|
||||
{
|
||||
return this.locations[index].Value;
|
||||
}
|
||||
|
||||
protected void SetVariableValue(int index, object value)
|
||||
{
|
||||
this.locations[index].Value = value;
|
||||
}
|
||||
|
||||
protected virtual void GetValueTypeValues()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void SetValueTypeValues()
|
||||
{
|
||||
}
|
||||
|
||||
protected Expression RewriteExpressionTree(Expression originalExpression)
|
||||
{
|
||||
LambdaExpression lambdaExpression = originalExpression as LambdaExpression;
|
||||
|
||||
if (lambdaExpression == null)
|
||||
{
|
||||
throw FxTrace.Exception.Argument("originalExpression", SR.LambdaExpressionTypeRequired);
|
||||
}
|
||||
|
||||
if (lambdaExpression.ReturnType == null || lambdaExpression.ReturnType == typeof(void))
|
||||
{
|
||||
throw FxTrace.Exception.Argument("originalExpression", SR.LambdaExpressionReturnTypeInvalid);
|
||||
}
|
||||
|
||||
return this.visitor.Visit(Expression.Lambda(
|
||||
typeof(Func<,>).MakeGenericType(typeof(ActivityContext), lambdaExpression.ReturnType),
|
||||
lambdaExpression.Body,
|
||||
new ParameterExpression[] { ExpressionUtilities.RuntimeContextParameter }));
|
||||
}
|
||||
|
||||
public Location<T> GetLocation<T>(Func<T> getMethod, Action<T> setMethod, int expressionId, Activity compiledRootActivity, ActivityContext activityContext)
|
||||
{
|
||||
return new CompiledLocation<T>(getMethod, setMethod, this.locationReferences, this.locations, expressionId, compiledRootActivity, activityContext);
|
||||
}
|
||||
|
||||
public Location<T> GetLocation<T>(Func<T> getMethod, Action<T> setMethod)
|
||||
{
|
||||
return new CompiledLocation<T>(getMethod, setMethod);
|
||||
}
|
||||
|
||||
protected static object GetDataContextActivities(Activity compiledRoot, bool forImplementation)
|
||||
{
|
||||
CompiledDataContextActivityVistor vistor = new CompiledDataContextActivityVistor();
|
||||
vistor.Visit(compiledRoot, forImplementation);
|
||||
CompiledDataContextActivitiesCache cache = new CompiledDataContextActivitiesCache(vistor.DataContextActivities);
|
||||
return cache;
|
||||
}
|
||||
|
||||
protected static CompiledDataContext[] GetCompiledDataContextCache(object dataContextActivities, ActivityContext activityContext, Activity compiledRoot, bool forImplementation, int compiledDataContextCount)
|
||||
{
|
||||
ActivityInstance cacheInstance = GetDataContextInstance((CompiledDataContextActivitiesCache)dataContextActivities, activityContext, compiledRoot);
|
||||
|
||||
HybridDictionary<Activity, CompiledDataContext[]> cache = null;
|
||||
if (forImplementation)
|
||||
{
|
||||
cache = (HybridDictionary<Activity, CompiledDataContext[]>)cacheInstance.CompiledDataContextsForImplementation;
|
||||
}
|
||||
else
|
||||
{
|
||||
cache = (HybridDictionary<Activity, CompiledDataContext[]>)cacheInstance.CompiledDataContexts;
|
||||
}
|
||||
|
||||
if (cache == null)
|
||||
{
|
||||
cache = new HybridDictionary<Activity, CompiledDataContext[]>();
|
||||
|
||||
if (forImplementation)
|
||||
{
|
||||
cacheInstance.CompiledDataContextsForImplementation = cache;
|
||||
}
|
||||
else
|
||||
{
|
||||
cacheInstance.CompiledDataContexts = cache;
|
||||
}
|
||||
}
|
||||
|
||||
CompiledDataContext[] result = null;
|
||||
if (!cache.TryGetValue(compiledRoot, out result))
|
||||
{
|
||||
result = new CompiledDataContext[compiledDataContextCount];
|
||||
cache.Add(compiledRoot, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static ActivityInstance GetDataContextInstance(CompiledDataContextActivitiesCache dataContextActivities, ActivityContext activityContext, Activity compiledRoot)
|
||||
{
|
||||
ActivityInstance dataContextInstance = null;
|
||||
|
||||
ActivityInstance currentInstance = activityContext.CurrentInstance;
|
||||
|
||||
while (currentInstance != null)
|
||||
{
|
||||
if (dataContextActivities.Contains(currentInstance.Activity))
|
||||
{
|
||||
dataContextInstance = currentInstance;
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Make sure we don't walk out of our IdSpace
|
||||
if (currentInstance.Activity == compiledRoot)
|
||||
{
|
||||
break;
|
||||
}
|
||||
//
|
||||
// For SecondaryRoot scenarios the ActivityInstance tree may not
|
||||
// contain any of the data context activity instances because
|
||||
// the instance tree does not have to match the activity definition tree.
|
||||
// In this case just use the root instance.
|
||||
if (currentInstance.Parent == null)
|
||||
{
|
||||
dataContextInstance = currentInstance;
|
||||
}
|
||||
|
||||
currentInstance = currentInstance.Parent;
|
||||
}
|
||||
|
||||
if (dataContextInstance == null)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SR.CompiledExpressionsNoCompiledRoot(activityContext.Activity.Id)));
|
||||
}
|
||||
|
||||
return dataContextInstance;
|
||||
}
|
||||
|
||||
IList<Location> ConvertReferences(IList<LocationReference> locationReferences, ActivityContext activityContext)
|
||||
{
|
||||
IList<Location> temp = new List<Location>(locationReferences.Count);
|
||||
|
||||
foreach (LocationReference reference in locationReferences)
|
||||
{
|
||||
temp.Add(reference.GetLocation(activityContext));
|
||||
}
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
class CompiledDataContextActivitiesCache
|
||||
{
|
||||
bool optimized;
|
||||
HashSet<Activity> activities;
|
||||
|
||||
Activity activity0;
|
||||
Activity activity1;
|
||||
Activity activity2;
|
||||
Activity activity3;
|
||||
Activity activity4;
|
||||
|
||||
public CompiledDataContextActivitiesCache(HashSet<Activity> dataContextActivities)
|
||||
{
|
||||
this.activities = dataContextActivities;
|
||||
|
||||
if (this.activities != null && this.activities.Count <= 5)
|
||||
{
|
||||
Activity[] activitiesArray = new Activity[5];
|
||||
this.activities.CopyTo(activitiesArray);
|
||||
|
||||
activity0 = activitiesArray[0];
|
||||
activity1 = activitiesArray[1];
|
||||
activity2 = activitiesArray[2];
|
||||
activity3 = activitiesArray[3];
|
||||
activity4 = activitiesArray[4];
|
||||
|
||||
this.optimized = true;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Contains(Activity target)
|
||||
{
|
||||
if (this.optimized)
|
||||
{
|
||||
if (this.activity0 == target)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (this.activity1 == target)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (this.activity2 == target)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (this.activity3 == target)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (this.activity4 == target)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.activities.Contains(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CompiledDataContextActivityVistor : CompiledExpressionActivityVisitor
|
||||
{
|
||||
HashSet<Activity> dataContextActivities;
|
||||
bool inVariableScopeArgument;
|
||||
|
||||
public CompiledDataContextActivityVistor()
|
||||
{
|
||||
this.dataContextActivities = new HashSet<Activity>(new ReferenceComparer<Activity>());
|
||||
}
|
||||
|
||||
public HashSet<Activity> DataContextActivities
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.dataContextActivities;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void VisitRoot(Activity activity, out bool exit)
|
||||
{
|
||||
this.dataContextActivities.Add(activity);
|
||||
base.VisitRoot(activity, out exit);
|
||||
}
|
||||
|
||||
protected override void VisitVariableScope(Activity activity, out bool exit)
|
||||
{
|
||||
if (!this.dataContextActivities.Contains(activity))
|
||||
{
|
||||
this.dataContextActivities.Add(activity);
|
||||
}
|
||||
base.VisitVariableScope(activity, out exit);
|
||||
}
|
||||
|
||||
protected override void VisitDelegate(ActivityDelegate activityDelegate, out bool exit)
|
||||
{
|
||||
if (activityDelegate.Handler != null)
|
||||
{
|
||||
this.dataContextActivities.Add(activityDelegate.Handler);
|
||||
}
|
||||
base.VisitDelegate(activityDelegate, out exit);
|
||||
}
|
||||
|
||||
protected override void VisitVariableScopeArgument(RuntimeArgument runtimeArgument, out bool exit)
|
||||
{
|
||||
this.inVariableScopeArgument = true;
|
||||
base.VisitVariableScopeArgument(runtimeArgument, out exit);
|
||||
this.inVariableScopeArgument = false;
|
||||
}
|
||||
|
||||
protected override void VisitITextExpression(Activity activity, out bool exit)
|
||||
{
|
||||
if (this.inVariableScopeArgument)
|
||||
{
|
||||
this.dataContextActivities.Add(activity);
|
||||
}
|
||||
base.VisitITextExpression(activity, out exit);
|
||||
}
|
||||
}
|
||||
|
||||
class ReferenceComparer<T> : IEqualityComparer<T>
|
||||
{
|
||||
bool IEqualityComparer<T>.Equals(T x, T y)
|
||||
{
|
||||
return object.ReferenceEquals(x, y);
|
||||
}
|
||||
|
||||
int IEqualityComparer<T>.GetHashCode(T target)
|
||||
{
|
||||
return target.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,443 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System;
|
||||
using System.Activities;
|
||||
using System.Activities.Expressions;
|
||||
using System.Collections.Generic;
|
||||
|
||||
internal abstract class CompiledExpressionActivityVisitor
|
||||
{
|
||||
protected bool ForImplementation
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public void Visit(Activity activity, bool forImplementation)
|
||||
{
|
||||
this.ForImplementation = forImplementation;
|
||||
bool exit;
|
||||
|
||||
VisitRoot(activity, out exit);
|
||||
}
|
||||
|
||||
void VisitCore(Activity activity, out bool exit)
|
||||
{
|
||||
if (activity is ITextExpression)
|
||||
{
|
||||
VisitITextExpression(activity, out exit);
|
||||
return;
|
||||
}
|
||||
// Look for variable scopes
|
||||
if (activity.RuntimeVariables != null && activity.RuntimeVariables.Count > 0)
|
||||
{
|
||||
VisitVariableScope(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Visit(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
protected virtual void Visit(Activity activity, out bool exit)
|
||||
{
|
||||
VisitArguments(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VisitPublicActivities(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void VisitRoot(Activity activity, out bool exit)
|
||||
{
|
||||
if (this.ForImplementation)
|
||||
{
|
||||
VisitRootImplementation(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
exit = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisitRootPublic(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
exit = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void VisitRootImplementationArguments(Activity activity, out bool exit)
|
||||
{
|
||||
VisitArguments(activity, out exit, VisitRootImplementationArgument);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
exit = false;
|
||||
}
|
||||
|
||||
protected virtual void VisitRootImplementationArgument(RuntimeArgument runtimeArgument, out bool exit)
|
||||
{
|
||||
if (runtimeArgument.IsBound)
|
||||
{
|
||||
Activity expression = runtimeArgument.BoundArgument.Expression;
|
||||
if (expression != null)
|
||||
{
|
||||
VisitCore(expression, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
exit = false;
|
||||
}
|
||||
|
||||
protected virtual void VisitVariableScope(Activity activity, out bool exit)
|
||||
{
|
||||
//
|
||||
// Walk the contained variables' default expressions
|
||||
foreach (Variable v in activity.RuntimeVariables)
|
||||
{
|
||||
if (v.Default != null)
|
||||
{
|
||||
VisitCore(v.Default, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VisitVariableScopeArguments(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VisitPublicActivities(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
exit = false;
|
||||
}
|
||||
|
||||
protected virtual void VisitRootImplementationScope(Activity activity, out bool exit)
|
||||
{
|
||||
foreach (Variable v in activity.RuntimeVariables)
|
||||
{
|
||||
if (v.Default != null)
|
||||
{
|
||||
VisitCore(v.Default, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VisitImportedChildren(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VisitImportedDelegates(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void VisitITextExpression(Activity activity, out bool exit)
|
||||
{
|
||||
exit = false;
|
||||
}
|
||||
|
||||
protected virtual void VisitChildren(Activity activity, out bool exit)
|
||||
{
|
||||
if (activity.Children != null)
|
||||
{
|
||||
for (int i = 0; i < activity.Children.Count; i++)
|
||||
{
|
||||
if (activity == activity.Children[i].Parent)
|
||||
{
|
||||
VisitCore(activity.Children[i], out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exit = false;
|
||||
}
|
||||
|
||||
protected virtual void VisitImportedChildren(Activity activity, out bool exit)
|
||||
{
|
||||
if (activity.ImportedChildren != null)
|
||||
{
|
||||
for (int i = 0; i < activity.ImportedChildren.Count; i++)
|
||||
{
|
||||
VisitCore(activity.ImportedChildren[i], out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
exit = false;
|
||||
}
|
||||
|
||||
protected virtual void VisitDelegates(Activity activity, out bool exit)
|
||||
{
|
||||
if (activity.Delegates != null)
|
||||
{
|
||||
foreach (ActivityDelegate activityDelegate in activity.Delegates)
|
||||
{
|
||||
if (activity == activityDelegate.Owner)
|
||||
{
|
||||
VisitDelegate(activityDelegate, out exit);
|
||||
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exit = false;
|
||||
}
|
||||
|
||||
protected virtual void VisitImportedDelegates(Activity activity, out bool exit)
|
||||
{
|
||||
if (activity.ImportedDelegates != null)
|
||||
{
|
||||
foreach (ActivityDelegate activityDelegate in activity.ImportedDelegates)
|
||||
{
|
||||
VisitDelegate(activityDelegate, out exit);
|
||||
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
exit = false;
|
||||
}
|
||||
|
||||
protected virtual void VisitDelegate(ActivityDelegate activityDelegate, out bool exit)
|
||||
{
|
||||
VisitDelegateArguments(activityDelegate, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (activityDelegate.Handler != null)
|
||||
{
|
||||
VisitCore(activityDelegate.Handler, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void VisitDelegateArguments(ActivityDelegate activityDelegate, out bool exit)
|
||||
{
|
||||
foreach (RuntimeDelegateArgument delegateArgument in activityDelegate.RuntimeDelegateArguments)
|
||||
{
|
||||
if (delegateArgument.BoundArgument != null)
|
||||
{
|
||||
VisitDelegateArgument(delegateArgument, out exit);
|
||||
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit = false;
|
||||
}
|
||||
|
||||
protected virtual void VisitDelegateArgument(RuntimeDelegateArgument delegateArgument, out bool exit)
|
||||
{
|
||||
//
|
||||
// Nothing further to walk into here, this is just a stub for implementors to override
|
||||
exit = false;
|
||||
}
|
||||
|
||||
protected virtual void VisitVariableScopeArguments(Activity activity, out bool exit)
|
||||
{
|
||||
VisitArguments(activity, out exit, VisitVariableScopeArgument);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
exit = false;
|
||||
}
|
||||
|
||||
protected virtual void VisitVariableScopeArgument(RuntimeArgument runtimeArgument, out bool exit)
|
||||
{
|
||||
VisitArgument(runtimeArgument, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
exit = false;
|
||||
}
|
||||
|
||||
protected virtual void VisitArguments(Activity activity, out bool exit)
|
||||
{
|
||||
VisitArguments(activity, out exit, VisitArgument);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
exit = false;
|
||||
}
|
||||
|
||||
protected virtual void VisitArgument(RuntimeArgument runtimeArgument, out bool exit)
|
||||
{
|
||||
if (runtimeArgument.IsBound)
|
||||
{
|
||||
Activity expression = runtimeArgument.BoundArgument.Expression;
|
||||
if (expression != null)
|
||||
{
|
||||
VisitCore(expression, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
exit = false;
|
||||
}
|
||||
|
||||
void VisitRootPublic(Activity activity, out bool exit)
|
||||
{
|
||||
if (activity.RuntimeVariables != null && activity.RuntimeVariables.Count > 0)
|
||||
{
|
||||
VisitVariableScope(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VisitArguments(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VisitPublicActivities(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VisitRootImplementation(Activity activity, out bool exit)
|
||||
{
|
||||
VisitRootImplementationArguments(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VisitRootImplementationScope(activity, out exit);
|
||||
|
||||
if (activity.ImplementationChildren != null)
|
||||
{
|
||||
for (int i = 0; i < activity.ImplementationChildren.Count; i++)
|
||||
{
|
||||
VisitCore(activity.ImplementationChildren[i], out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
exit = false;
|
||||
}
|
||||
|
||||
void VisitPublicActivities(Activity activity, out bool exit)
|
||||
{
|
||||
VisitChildren(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VisitDelegates(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VisitImportedChildren(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VisitImportedDelegates(activity, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void VisitArguments(Activity activity, out bool exit, VisitArgumentDelegate visitArgument)
|
||||
{
|
||||
foreach (RuntimeArgument runtimeArgument in activity.RuntimeArguments)
|
||||
{
|
||||
visitArgument(runtimeArgument, out exit);
|
||||
if (exit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
exit = false;
|
||||
}
|
||||
|
||||
delegate void VisitArgumentDelegate(RuntimeArgument runtimeArgument, out bool exit);
|
||||
}
|
||||
}
|
@@ -0,0 +1,310 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System;
|
||||
using System.Activities;
|
||||
using System.Activities.Expressions;
|
||||
using System.Activities.Runtime;
|
||||
using System.Runtime;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
|
||||
[DataContract(Name = XD.CompiledLocation.Name, Namespace = XD.Runtime.Namespace)]
|
||||
internal class CompiledLocation<T> : Location<T>
|
||||
{
|
||||
Func<T> getMethod;
|
||||
Action<T> setMethod;
|
||||
|
||||
int expressionId;
|
||||
|
||||
IList<LocationReference> locationReferences;
|
||||
|
||||
IList<Location> locations;
|
||||
|
||||
ActivityInstance rootInstance;
|
||||
|
||||
Activity compiledRootActivity;
|
||||
byte[] compiledRootActivityQualifiedId;
|
||||
|
||||
Activity expressionActivity;
|
||||
byte[] expressionActivityQualifiedId;
|
||||
|
||||
string expressionText;
|
||||
|
||||
bool forImplementation;
|
||||
|
||||
public CompiledLocation(Func<T> getMethod, Action<T> setMethod, IList<LocationReference> locationReferences, IList<Location> locations, int expressionId, Activity compiledRootActivity, ActivityContext currentActivityContext)
|
||||
{
|
||||
this.getMethod = getMethod;
|
||||
this.setMethod = setMethod;
|
||||
|
||||
this.forImplementation = currentActivityContext.Activity.MemberOf != currentActivityContext.Activity.RootActivity.MemberOf;
|
||||
this.locationReferences = locationReferences;
|
||||
this.locations = locations;
|
||||
this.expressionId = expressionId;
|
||||
|
||||
this.compiledRootActivity = compiledRootActivity;
|
||||
this.expressionActivity = currentActivityContext.Activity;
|
||||
//
|
||||
// Save the root activity instance to get the root activity post persistence
|
||||
// The root will always be alive as long as the location is valid, which is not
|
||||
// true for the activity instance of the expression that is executing
|
||||
this.rootInstance = currentActivityContext.CurrentInstance;
|
||||
while (this.rootInstance.Parent != null)
|
||||
{
|
||||
this.rootInstance = this.rootInstance.Parent;
|
||||
}
|
||||
//
|
||||
// Save the text of the expression for exception message
|
||||
ITextExpression textExpression = currentActivityContext.Activity as ITextExpression;
|
||||
if (textExpression != null)
|
||||
{
|
||||
this.expressionText = textExpression.ExpressionText;
|
||||
}
|
||||
}
|
||||
|
||||
public CompiledLocation(Func<T> getMethod, Action<T> setMethod)
|
||||
{
|
||||
//
|
||||
// This is the constructor that is used to refresh the get/set methods during rehydration
|
||||
// An instance of this class created with the constructor cannot be invoked.
|
||||
this.getMethod = getMethod;
|
||||
this.setMethod = setMethod;
|
||||
}
|
||||
|
||||
public override T Value
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.getMethod == null)
|
||||
{
|
||||
RefreshAccessors();
|
||||
}
|
||||
return getMethod();
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this.setMethod == null)
|
||||
{
|
||||
RefreshAccessors();
|
||||
}
|
||||
setMethod(value);
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public byte[] CompiledRootActivityQualifiedId
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.compiledRootActivityQualifiedId == null)
|
||||
{
|
||||
return this.compiledRootActivity.QualifiedId.AsByteArray();
|
||||
}
|
||||
|
||||
return this.compiledRootActivityQualifiedId;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.compiledRootActivityQualifiedId = value;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public byte[] ExpressionActivityQualifiedId
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.expressionActivityQualifiedId == null)
|
||||
{
|
||||
return this.expressionActivity.QualifiedId.AsByteArray();
|
||||
}
|
||||
|
||||
return this.expressionActivityQualifiedId;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.expressionActivityQualifiedId = value;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IList<Tuple<string, Type>> locationReferenceCache
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.locationReferences == null || this.locationReferences.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Tuple<string, Type>> durableCache = new List<Tuple<string, Type>>(this.locationReferences.Count);
|
||||
|
||||
foreach (LocationReference reference in locationReferences)
|
||||
{
|
||||
durableCache.Add(new Tuple<string, Type>(reference.Name, reference.Type));
|
||||
}
|
||||
|
||||
return durableCache;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null || value.Count == 0)
|
||||
{
|
||||
this.locationReferences = new List<LocationReference>();
|
||||
return;
|
||||
}
|
||||
|
||||
this.locationReferences = new List<LocationReference>(value.Count);
|
||||
foreach (Tuple<string, Type> reference in value)
|
||||
{
|
||||
this.locationReferences.Add(new CompiledLocationReference(reference.Item1, reference.Item2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Name = "expressionId")]
|
||||
internal int SerializedExpressionId
|
||||
{
|
||||
get { return this.expressionId; }
|
||||
set { this.expressionId = value; }
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Name = "locations")]
|
||||
internal IList<Location> SerializedLocations
|
||||
{
|
||||
get { return this.locations; }
|
||||
set { this.locations = value; }
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Name = "rootInstance")]
|
||||
internal ActivityInstance SerializedRootInstance
|
||||
{
|
||||
get { return this.rootInstance; }
|
||||
set { this.rootInstance = value; }
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Name = "expressionText")]
|
||||
internal string SerializedExpressionText
|
||||
{
|
||||
get { return this.expressionText; }
|
||||
set { this.expressionText = value; }
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Name = "forImplementation")]
|
||||
internal bool SerializedForImplementation
|
||||
{
|
||||
get { return this.forImplementation; }
|
||||
set { this.forImplementation = value; }
|
||||
}
|
||||
|
||||
void RefreshAccessors()
|
||||
{
|
||||
//
|
||||
// If we've gotten here is means that we have a location that has roundtripped through persistence
|
||||
// CompiledDataContext & ICER don't round trip so we need to get them back from the current tree
|
||||
// and get new pointers to the get/set methods for this expression
|
||||
ICompiledExpressionRoot compiledRoot = GetCompiledExpressionRoot();
|
||||
CompiledLocation<T> tempLocation = (CompiledLocation<T>)compiledRoot.InvokeExpression(this.expressionId, this.locations);
|
||||
this.getMethod = tempLocation.getMethod;
|
||||
this.setMethod = tempLocation.setMethod;
|
||||
}
|
||||
|
||||
ICompiledExpressionRoot GetCompiledExpressionRoot()
|
||||
{
|
||||
if (this.rootInstance != null && this.rootInstance.Activity != null)
|
||||
{
|
||||
ICompiledExpressionRoot compiledExpressionRoot;
|
||||
Activity rootActivity = this.rootInstance.Activity;
|
||||
|
||||
Activity compiledRootActivity = null;
|
||||
Activity expressionActivity = null;
|
||||
|
||||
if (QualifiedId.TryGetElementFromRoot(rootActivity, this.compiledRootActivityQualifiedId, out compiledRootActivity) &&
|
||||
QualifiedId.TryGetElementFromRoot(rootActivity, this.expressionActivityQualifiedId, out expressionActivity))
|
||||
{
|
||||
if (CompiledExpressionInvoker.TryGetCompiledExpressionRoot(expressionActivity, compiledRootActivity, out compiledExpressionRoot))
|
||||
{
|
||||
//
|
||||
// Revalidate to make sure we didn't hit an ID shift
|
||||
if (compiledExpressionRoot.CanExecuteExpression(this.expressionText, true /* this is always a reference */, this.locationReferences, out this.expressionId))
|
||||
{
|
||||
return compiledExpressionRoot;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// We were valid when this location was generated so an ID shift occurred (likely due to a dynamic update)
|
||||
// Need to search all of the ICERs for one that can execute this expression.
|
||||
if (FindCompiledExpressionRoot(rootActivity, out compiledExpressionRoot))
|
||||
{
|
||||
return compiledExpressionRoot;
|
||||
}
|
||||
}
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SR.UnableToLocateCompiledLocationContext(this.expressionText)));
|
||||
}
|
||||
|
||||
bool FindCompiledExpressionRoot(Activity activity, out ICompiledExpressionRoot compiledExpressionRoot)
|
||||
{
|
||||
if (CompiledExpressionInvoker.TryGetCompiledExpressionRoot(activity, this.forImplementation, out compiledExpressionRoot))
|
||||
{
|
||||
if (compiledExpressionRoot.CanExecuteExpression(this.expressionText, true /* this is always a reference */, this.locationReferences, out this.expressionId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Activity containedActivity in WorkflowInspectionServices.GetActivities(activity))
|
||||
{
|
||||
if (FindCompiledExpressionRoot(containedActivity, out compiledExpressionRoot))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
compiledExpressionRoot = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
class CompiledLocationReference : LocationReference
|
||||
{
|
||||
string name;
|
||||
Type type;
|
||||
|
||||
public CompiledLocationReference(string name, Type type)
|
||||
{
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
protected override string NameCore
|
||||
{
|
||||
get
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
protected override Type TypeCore
|
||||
{
|
||||
get
|
||||
{
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
public override Location GetLocation(ActivityContext context)
|
||||
{
|
||||
//
|
||||
// We should never hit this, these references are strictly for preserving location names/types
|
||||
// through persistence to allow for revalidation on the other side
|
||||
// Actual execution occurs through the locations that were stored separately
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SR.CompiledLocationReferenceGetLocation));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,102 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Markup;
|
||||
using System.Xaml;
|
||||
|
||||
class ConcatenatingXamlReader : XamlReader
|
||||
{
|
||||
// Invariant: !isEof => readers.Current != null
|
||||
bool isEof;
|
||||
IEnumerator<XamlReader> readers;
|
||||
XamlSchemaContext schemaContext;
|
||||
|
||||
public ConcatenatingXamlReader(params XamlReader[] readers)
|
||||
{
|
||||
this.readers = ((IEnumerable<XamlReader>)readers).GetEnumerator();
|
||||
if (this.readers.MoveNext())
|
||||
{
|
||||
this.schemaContext = this.readers.Current.SchemaContext;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.isEof = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsEof
|
||||
{
|
||||
get { return this.isEof ? true : this.readers.Current.IsEof; }
|
||||
}
|
||||
|
||||
public override XamlMember Member
|
||||
{
|
||||
get { return this.isEof ? null : this.readers.Current.Member; }
|
||||
}
|
||||
|
||||
public override NamespaceDeclaration Namespace
|
||||
{
|
||||
get { return this.isEof ? null : this.readers.Current.Namespace; }
|
||||
}
|
||||
|
||||
public override XamlNodeType NodeType
|
||||
{
|
||||
get { return this.isEof ? XamlNodeType.None : this.readers.Current.NodeType; }
|
||||
}
|
||||
|
||||
public override XamlSchemaContext SchemaContext
|
||||
{
|
||||
get { return this.schemaContext; }
|
||||
}
|
||||
|
||||
public override XamlType Type
|
||||
{
|
||||
get { return this.isEof ? null : this.readers.Current.Type; }
|
||||
}
|
||||
|
||||
public override object Value
|
||||
{
|
||||
get { return this.isEof ? null : this.readers.Current.Value; }
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && !this.isEof)
|
||||
{
|
||||
readers.Current.Close();
|
||||
while (readers.MoveNext())
|
||||
{
|
||||
readers.Current.Close();
|
||||
}
|
||||
this.isEof = true;
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
public override bool Read()
|
||||
{
|
||||
if (!this.isEof)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (this.readers.Current.Read())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
this.readers.Current.Close();
|
||||
}
|
||||
while (this.readers.MoveNext());
|
||||
this.isEof = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,31 @@
|
||||
// <copyright>
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System;
|
||||
using System.Activities.DynamicUpdate;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Windows.Markup;
|
||||
|
||||
public class DynamicUpdateMapConverter : TypeConverter
|
||||
{
|
||||
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
|
||||
{
|
||||
return destinationType == typeof(MarkupExtension);
|
||||
}
|
||||
|
||||
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
DynamicUpdateMap map = value as DynamicUpdateMap;
|
||||
if (destinationType == typeof(MarkupExtension) && map != null)
|
||||
{
|
||||
return new DynamicUpdateMapExtension(map);
|
||||
}
|
||||
|
||||
return base.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
// <copyright>
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System;
|
||||
using System.Activities.DynamicUpdate;
|
||||
using System.Windows.Markup;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
[ContentProperty("XmlContent")]
|
||||
public class DynamicUpdateMapExtension : MarkupExtension
|
||||
{
|
||||
private NetDataContractXmlSerializable<DynamicUpdateMap> content;
|
||||
|
||||
public DynamicUpdateMapExtension()
|
||||
{
|
||||
}
|
||||
|
||||
public DynamicUpdateMapExtension(DynamicUpdateMap updateMap)
|
||||
{
|
||||
this.content = new NetDataContractXmlSerializable<DynamicUpdateMap>(updateMap);
|
||||
}
|
||||
|
||||
public DynamicUpdateMap UpdateMap
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.content != null ? this.content.Value : null;
|
||||
}
|
||||
}
|
||||
|
||||
public IXmlSerializable XmlContent
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.content == null)
|
||||
{
|
||||
this.content = new NetDataContractXmlSerializable<DynamicUpdateMap>();
|
||||
}
|
||||
|
||||
return this.content;
|
||||
}
|
||||
}
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
return this.UpdateMap;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
// <copyright>
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System;
|
||||
using System.Activities.DynamicUpdate;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
|
||||
public class DynamicUpdateMapItemConverter : TypeConverter
|
||||
{
|
||||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
|
||||
{
|
||||
return sourceType == typeof(string);
|
||||
}
|
||||
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
string stringValue = value as string;
|
||||
if (stringValue != null)
|
||||
{
|
||||
int result1;
|
||||
int result2;
|
||||
string[] strArray = stringValue.Split(new char[] { '.' });
|
||||
if (strArray.Length == 1)
|
||||
{
|
||||
if (int.TryParse(strArray[0], NumberStyles.Integer, culture, out result1))
|
||||
{
|
||||
return new DynamicUpdateMapItem(result1);
|
||||
}
|
||||
}
|
||||
else if (strArray.Length == 2)
|
||||
{
|
||||
if (int.TryParse(strArray[0], NumberStyles.Integer, culture, out result1) && int.TryParse(strArray[1], NumberStyles.Integer, culture, out result2))
|
||||
{
|
||||
return new DynamicUpdateMapItem(result1, result2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
|
||||
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
|
||||
{
|
||||
return destinationType == typeof(string);
|
||||
}
|
||||
|
||||
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
DynamicUpdateMapItem objectInfo = value as DynamicUpdateMapItem;
|
||||
if (destinationType == typeof(string) && objectInfo != null)
|
||||
{
|
||||
if (objectInfo.IsVariableMapItem)
|
||||
{
|
||||
// MapItem for Variable is converted to a string with its owner Id plus the variable index delimeted by "."
|
||||
// Assumption: No culture uses "." in its Int32 string representation
|
||||
return objectInfo.OriginalVariableOwnerId.ToString(culture) + "." + objectInfo.OriginalId.ToString(culture);
|
||||
}
|
||||
return objectInfo.OriginalId.ToString(culture);
|
||||
}
|
||||
|
||||
return base.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,82 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System.Activities.Expressions;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
|
||||
class ExpressionTreeRewriter : ExpressionVisitor
|
||||
{
|
||||
IList<LocationReference> locationReferences;
|
||||
|
||||
public ExpressionTreeRewriter()
|
||||
{
|
||||
}
|
||||
|
||||
public ExpressionTreeRewriter(IList<LocationReference> locationReferences)
|
||||
{
|
||||
this.locationReferences = locationReferences;
|
||||
}
|
||||
|
||||
protected override Expression VisitMember(MemberExpression node)
|
||||
{
|
||||
Expression newNode = null;
|
||||
if (node.Expression != null && node.Expression.NodeType == ExpressionType.Constant)
|
||||
{
|
||||
ConstantExpression constExpr = (ConstantExpression)node.Expression;
|
||||
if (typeof(CompiledDataContext).IsAssignableFrom(constExpr.Type) &&
|
||||
this.TryRewriteMemberExpressionNode(node, out newNode))
|
||||
{
|
||||
return newNode;
|
||||
}
|
||||
}
|
||||
|
||||
return base.VisitMember(node);
|
||||
}
|
||||
|
||||
protected override Expression VisitConstant(ConstantExpression node)
|
||||
{
|
||||
if (node.Value != null && node.Value.GetType() == typeof(InlinedLocationReference))
|
||||
{
|
||||
Expression newNode = node;
|
||||
ILocationReferenceWrapper inlinedReference = (ILocationReferenceWrapper)node.Value;
|
||||
if (inlinedReference != null)
|
||||
{
|
||||
newNode = Expression.Constant(inlinedReference.LocationReference, typeof(LocationReference));
|
||||
return newNode;
|
||||
}
|
||||
}
|
||||
|
||||
return base.VisitConstant(node);
|
||||
}
|
||||
|
||||
bool TryRewriteMemberExpressionNode(MemberExpression node, out Expression newNode)
|
||||
{
|
||||
newNode = null;
|
||||
if (this.locationReferences != null)
|
||||
{
|
||||
foreach (LocationReference locationReference in this.locationReferences)
|
||||
{
|
||||
if (node.Member.Name == locationReference.Name)
|
||||
{
|
||||
if (locationReference is ILocationReferenceWrapper)
|
||||
{
|
||||
newNode = ExpressionUtilities.CreateIdentifierExpression(((ILocationReferenceWrapper)locationReference).LocationReference);
|
||||
}
|
||||
else
|
||||
{
|
||||
newNode = ExpressionUtilities.CreateIdentifierExpression(locationReference);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,137 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using System.Runtime;
|
||||
using System.Windows.Markup;
|
||||
using System.Xaml;
|
||||
|
||||
abstract class FuncFactory
|
||||
{
|
||||
public static Func<object> CreateFunc(XamlReader reader, Type returnType)
|
||||
{
|
||||
FuncFactory factory = CreateFactory(null, reader, returnType);
|
||||
return factory.GetFunc();
|
||||
}
|
||||
|
||||
public static Func<T> CreateFunc<T>(XamlReader reader) where T : class
|
||||
{
|
||||
FuncFactory<T> factory = new FuncFactory<T>(null, reader);
|
||||
return factory.GetTypedFunc();
|
||||
}
|
||||
|
||||
internal IList<NamespaceDeclaration> ParentNamespaces
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
internal XamlNodeList Nodes
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// Back-compat switch: we don't want to copy parent settings on Activity/DynamicActivity
|
||||
internal bool IgnoreParentSettings
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
internal abstract Func<object> GetFunc();
|
||||
|
||||
internal static FuncFactory CreateFactory(XamlReader xamlReader, IServiceProvider context)
|
||||
{
|
||||
IXamlObjectWriterFactory objectWriterFactory = context.GetService(typeof(IXamlObjectWriterFactory)) as IXamlObjectWriterFactory;
|
||||
IProvideValueTarget provideValueService = context.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;
|
||||
|
||||
Type propertyType = null;
|
||||
//
|
||||
// IProvideValueTarget.TargetProperty can return DP, Attached Property or MemberInfo for clr property
|
||||
// In this case it should always be a regular clr property here - we are always targeting Activity.Body.
|
||||
PropertyInfo propertyInfo = provideValueService.TargetProperty as PropertyInfo;
|
||||
|
||||
if (propertyInfo != null)
|
||||
{
|
||||
propertyType = propertyInfo.PropertyType;
|
||||
}
|
||||
|
||||
FuncFactory funcFactory = CreateFactory(objectWriterFactory, xamlReader, propertyType.GetGenericArguments());
|
||||
return funcFactory;
|
||||
}
|
||||
|
||||
// Back-compat workaround: returnType should only be a single value. But in 4.0 we didn't
|
||||
// validate this; we just passed the array in to MakeGenericType, which would throw if there
|
||||
// were multiple values. To preserve the same exception, we allow passing in an array here.
|
||||
static FuncFactory CreateFactory(IXamlObjectWriterFactory objectWriterFactory, XamlReader xamlReader, params Type[] returnType)
|
||||
{
|
||||
Type closedType = typeof(FuncFactory<>).MakeGenericType(returnType);
|
||||
return (FuncFactory)Activator.CreateInstance(closedType, objectWriterFactory, xamlReader);
|
||||
}
|
||||
}
|
||||
|
||||
class FuncFactory<T> : FuncFactory where T : class
|
||||
{
|
||||
IXamlObjectWriterFactory objectWriterFactory;
|
||||
|
||||
public FuncFactory(IXamlObjectWriterFactory objectWriterFactory, XamlReader reader)
|
||||
{
|
||||
this.objectWriterFactory = objectWriterFactory;
|
||||
this.Nodes = new XamlNodeList(reader.SchemaContext);
|
||||
XamlServices.Transform(reader, this.Nodes.Writer);
|
||||
}
|
||||
|
||||
internal T Evaluate()
|
||||
{
|
||||
XamlObjectWriter writer = GetWriter();
|
||||
XamlServices.Transform(this.Nodes.GetReader(), writer);
|
||||
return (T)writer.Result;
|
||||
}
|
||||
|
||||
internal override Func<object> GetFunc()
|
||||
{
|
||||
return (Func<T>)Evaluate;
|
||||
}
|
||||
|
||||
internal Func<T> GetTypedFunc()
|
||||
{
|
||||
return Evaluate;
|
||||
}
|
||||
|
||||
XamlObjectWriter GetWriter()
|
||||
{
|
||||
if (this.objectWriterFactory != null)
|
||||
{
|
||||
return this.objectWriterFactory.GetXamlObjectWriter(GetObjectWriterSettings());
|
||||
}
|
||||
else
|
||||
{
|
||||
return new XamlObjectWriter(this.Nodes.Writer.SchemaContext);
|
||||
}
|
||||
}
|
||||
|
||||
XamlObjectWriterSettings GetObjectWriterSettings()
|
||||
{
|
||||
if (IgnoreParentSettings)
|
||||
{
|
||||
return new XamlObjectWriterSettings();
|
||||
}
|
||||
XamlObjectWriterSettings result = new XamlObjectWriterSettings(this.objectWriterFactory.GetParentSettings());
|
||||
// The delegate settings are already stripped by XOW. Some other settings don't make sense to copy.
|
||||
result.ExternalNameScope = null;
|
||||
result.RegisterNamesOnExternalNamescope = false;
|
||||
result.RootObjectInstance = null;
|
||||
result.SkipProvideValueOnRoot = false;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,27 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Markup;
|
||||
using System.Xaml;
|
||||
|
||||
public class FuncDeferringLoader : XamlDeferringLoader
|
||||
{
|
||||
public override object Load(XamlReader xamlReader, IServiceProvider context)
|
||||
{
|
||||
FuncFactory factory = FuncFactory.CreateFactory(xamlReader, context);
|
||||
factory.IgnoreParentSettings = true;
|
||||
return factory.GetFunc();
|
||||
}
|
||||
|
||||
public override XamlReader Save(object value, IServiceProvider serviceProvider)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new NotSupportedException(SR.SavingActivityToXamlNotSupported));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,29 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System;
|
||||
using System.Activities;
|
||||
using System.Activities.Expressions;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime;
|
||||
|
||||
public interface ICompiledExpressionRoot
|
||||
{
|
||||
string GetLanguage();
|
||||
|
||||
[SuppressMessage(FxCop.Category.Design, FxCop.Rule.AvoidOutParameters, Justification = "Interface is intended to be implemented only by generated code and consumed only by internal code")]
|
||||
bool CanExecuteExpression(string expressionText, bool isReference, IList<LocationReference> locations, out int expressionId);
|
||||
|
||||
object InvokeExpression(int expressionId, IList<LocationReference> locations, ActivityContext activityContext);
|
||||
object InvokeExpression(int expressionId, IList<Location> locations);
|
||||
|
||||
IList<string> GetRequiredLocations(int expressionId);
|
||||
|
||||
Expression GetExpressionTreeForExpression(int expressionId, IList<LocationReference> locationReferences);
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.XamlIntegration
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Markup;
|
||||
|
||||
public interface IValueSerializableExpression
|
||||
{
|
||||
bool CanConvertToString(IValueSerializerContext context);
|
||||
string ConvertToString(IValueSerializerContext context);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user