public override bool TryMorphExpression(ActivityWithResult expression, bool isLocationExpression, Type newType,
EditingContext context, out ActivityWithResult newExpression)
{
Fx.Assert(expression != null, "Original expression shouldn't be null in morph helper");
Fx.Assert(context != null, "EditingContext shouldn't be null in morph helper");
newExpression = null;
if (expression.ResultType == newType &&
(ExpressionHelper.IsGenericLocationExpressionType(expression) == isLocationExpression))
{
newExpression = expression;
return true;
}
if (context != null)
{
string expressionEditor = ExpressionHelper.GetRootEditorSetting(context.Services.GetService<ModelTreeManager>(), WorkflowDesigner.GetTargetFramework(context));
ParserContext parserContext = new ParserContext();
string expressionText = ExpressionHelper.GetExpressionString(expression, parserContext);
if (!string.IsNullOrEmpty(expressionEditor))
{
return ExpressionTextBox.TryConvertFromString(expressionEditor, expressionText, isLocationExpression, newType, out newExpression);
}
}
return false;
}
}