private static void UpdateTypeArgument(ModelItem modelItem, Type value) { if (value != null) { Type oldModelItemType = modelItem.ItemType; Type newModelItemType = oldModelItemType.GetGenericTypeDefinition().MakeGenericType(value); ModelItem newModelItem = ModelFactory.CreateItem(modelItem.GetEditingContext(), Activator.CreateInstance(newModelItemType)); MorphHelper.MorphObject(modelItem, newModelItem); MorphHelper.MorphProperties(modelItem, newModelItem); if (oldModelItemType.IsSubclassOf(typeof(Activity)) && newModelItemType.IsSubclassOf(typeof(Activity))) { if (string.Equals((string)modelItem.Properties["DisplayName"].ComputedValue, GetActivityDefaultName(oldModelItemType), StringComparison.Ordinal)) { newModelItem.Properties["DisplayName"].SetValue(GetActivityDefaultName(newModelItemType)); } } DesignerView designerView = modelItem.GetEditingContext().Services.GetService <DesignerView>(); if (designerView != null) { Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Render, (Action)(() => { if (designerView.RootDesigner != null && ((WorkflowViewElement)designerView.RootDesigner).ModelItem == modelItem) { designerView.MakeRootDesigner(newModelItem); } Selection.SelectOnly(modelItem.GetEditingContext(), newModelItem); })); } } }
public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource) { ModelPropertyEntryToOwnerActivityConverter ownerActivityConverter = new ModelPropertyEntryToOwnerActivityConverter(); ModelItem activityItem = ownerActivityConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null) as ModelItem; EditingContext context = activityItem.GetEditingContext(); ModelItem parentModelItem = ownerActivityConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), true, null) as ModelItem; ModelItemDictionary arguments = parentModelItem.Properties[propertyValue.ParentProperty.PropertyName].Dictionary; DynamicArgumentDesignerOptions options = new DynamicArgumentDesignerOptions { Title = propertyValue.ParentProperty.DisplayName }; using (ModelEditingScope change = arguments.BeginEdit("PowerShellParameterEditing")) { if (DynamicArgumentDialog.ShowDialog(activityItem, arguments, context, activityItem.View, options)) { change.Complete(); } else { change.Revert(); } } }
internal static Argument MorphArgument(ModelItem originalValue, Type targetType) { Argument morphed = null; Argument original = (Argument)originalValue.GetCurrentValue(); ActivityWithResult originalExpression = original.Expression; if (originalExpression != null) { Type expressionType = originalExpression.GetType(); Type expressionGenericType = expressionType.IsGenericType ? expressionType.GetGenericTypeDefinition() : null; if (expressionGenericType != null) { bool isLocation = ExpressionHelper.IsGenericLocationExpressionType(originalExpression); ActivityWithResult morphedExpression; EditingContext context = originalValue.GetEditingContext(); morphed = Argument.Create(targetType, original.Direction); if (ExpressionHelper.TryMorphExpression(originalExpression, isLocation, targetType, context, out morphedExpression)) { morphed.Expression = morphedExpression; } //[....] } } return(morphed); }
private static void UpdateTypeArgument(ModelItem modelItem, Int32 argumentIndex, Type newGenericType) { Type itemType = modelItem.ItemType; Type[] genericTypes = itemType.GetGenericArguments(); // Replace the type being changed genericTypes[argumentIndex] = newGenericType; Type newType = itemType.GetGenericTypeDefinition().MakeGenericType(genericTypes); EditingContext editingContext = modelItem.GetEditingContext(); Object instanceOfNewType = Activator.CreateInstance(newType); ModelItem newModelItem = ModelFactory.CreateItem(editingContext, instanceOfNewType); using (ModelEditingScope editingScope = newModelItem.BeginEdit("Change type argument")) { MorphHelper.MorphObject(modelItem, newModelItem); MorphHelper.MorphProperties(modelItem, newModelItem); if (itemType.IsSubclassOf(typeof(Activity)) && newType.IsSubclassOf(typeof(Activity))) { if (DisplayNameRequiresUpdate(modelItem)) { // Update to the new display name String newDisplayName = GetActivityDefaultName(newType); newModelItem.Properties[DisplayName].SetValue(newDisplayName); } } DesignerUpdater.UpdateModelItem(modelItem, newModelItem); editingScope.Complete(); } }
public ConnectionDialog(ModelItem modelItem) { ProviderNames = new List <string>(); List <string> providers = new List <string>(); #if NETFRAMEWORK providers.Add("Oracle.ManagedDataAccess.Client"); #endif #if NETCOREAPP DbProviderFactories.RegisterFactory("System.Data.SqlClient", System.Data.SqlClient.SqlClientFactory.Instance); DbProviderFactories.RegisterFactory("System.Data.OleDb", System.Data.OleDb.OleDbFactory.Instance); DbProviderFactories.RegisterFactory("System.Data.Odbc", System.Data.Odbc.OdbcFactory.Instance); DbProviderFactories.RegisterFactory("Oracle.ManagedDataAccess.Client", Oracle.ManagedDataAccess.Client.OracleClientFactory.Instance); #endif var installedProviders = DbProviderFactories.GetFactoryClasses(); foreach (DataRow installedProvider in installedProviders.Rows) { ProviderNames.Add(installedProvider["InvariantName"] as string); } foreach (var provider in providers) { if (!ProviderNames.Contains(provider)) { ProviderNames.Add(provider); } } InitializeComponent(); ModelItem = modelItem; Context = modelItem.GetEditingContext(); }
public static void OnAddAnnotationCommandExecuted(ExecutedRoutedEventArgs e, ModelItem modelItem) { ModelProperty property = modelItem.Properties.Find(Annotation.AnnotationTextPropertyName); if (property != null) { using (ModelEditingScope editingScope = modelItem.BeginEdit(SR.AddAnnotationDescription)) { property.SetValue(string.Empty); ViewStateService viewStateService = modelItem.GetEditingContext().Services.GetService <ViewStateService>(); viewStateService.StoreViewStateWithUndo(modelItem, Annotation.IsAnnotationDockedViewStateName, false); editingScope.Complete(); } if (modelItem.View != null) { WorkflowViewElement element = modelItem.View as WorkflowViewElement; if (element != null) { element.OnEditAnnotation(); } } } e.Handled = true; }
public static object ActivityActionMorphHelper(ModelItem originalValue, ModelProperty newModelProperty) { Fx.Assert(newModelProperty.PropertyType.GetGenericArguments().Count() == 1, "This should only be applied for ActivityAction<T>"); Type activityActionTypeArgument = newModelProperty.PropertyType.GetGenericArguments()[0]; Type activityActionType = typeof(ActivityAction <>).MakeGenericType(activityActionTypeArgument); object activityAction = Activator.CreateInstance(activityActionType); ModelItem morphed = ModelFactory.CreateItem(originalValue.GetEditingContext(), activityAction); ModelItem originalActivityActionArgument = originalValue.Properties[PropertyNames.ActionArgument].Value; if (originalActivityActionArgument != null) { Type variableType = typeof(DelegateInArgument <>).MakeGenericType(activityActionTypeArgument); DelegateInArgument iterationDelegateArgument = (DelegateInArgument)Activator.CreateInstance(variableType); iterationDelegateArgument.Name = (string)originalActivityActionArgument.Properties[PropertyNames.NameProperty].Value.GetCurrentValue(); morphed.Properties[PropertyNames.ActionArgument].SetValue(iterationDelegateArgument); } ModelItem originalActivityActionHandler = originalValue.Properties[PropertyNames.ActionHandler].Value; if (originalActivityActionHandler != null) { morphed.Properties[PropertyNames.ActionHandler].SetValue(originalActivityActionHandler); originalValue.Properties[PropertyNames.ActionHandler].SetValue(null); } return(morphed); }
public ParametersWizard(ModelItem ownerActivity, Int32 CmdType, String Name, String Id) { InitializeComponent(); this.ModelItem = ownerActivity; this.Context = ownerActivity.GetEditingContext(); // Initialize Parameters InitializeParameters(); if (Parameters.Count == 0) { EmptyParameter = true; Parameters.Add(new ParametersViewModel()); } UpdateParameterIndex(0); if (Salesforce_Marketing_Cloud_Scope.Design_VALIDCONN) { AuthToken = Salesforce_Marketing_Cloud_Scope.Design_AUTH; ServiceURL = Salesforce_Marketing_Cloud_Scope.Design_SERVICES; } CmdTYPE = (Type_of_Command)CmdType; NameDecision = Name; IdDecision = Id; switch (CmdTYPE) { case Type_of_Command.AddList: case Type_of_Command.UpdateList: ServiceName = "List"; cmdTypeMandatory = Type_of_Command.GetMandatoryList; break; case Type_of_Command.AddSubscriber: case Type_of_Command.UpdateSubscriber: ServiceName = "Subscriber"; cmdTypeMandatory = Type_of_Command.GetMandatorySubscriber; break; case Type_of_Command.AddDataExtension: case Type_of_Command.UpdateDataExtension: ServiceName = "DataExtension"; cmdTypeMandatory = Type_of_Command.GetMandatoryDataExtension; break; case Type_of_Command.AddDataExtensionObject: case Type_of_Command.UpdateDataExtensionObject: ServiceName = "DataExtensionObject"; cmdTypeMandatory = Type_of_Command.GetMandatoryDataExtensionObject; break; case Type_of_Command.AddCampaign: case Type_of_Command.UpdateCampaign: ServiceName = "campaigns"; cmdTypeMandatory = Type_of_Command.GetMandatoryCampaign; break; default: break; } // if ((CmdTYPE == Type_of_Command.AddCustom) || (CmdTYPE == Type_of_Command.UpdateCustom)) // btnMandatory.IsEnabled = false; }
public FilterDataTableWizard(ModelItem ownerActivity) { Filters = new ObservableCollection <FilterOperationViewModel>(); SelectColumns = new ObservableCollection <SelectColumnViewModel>(); this.InitializeComponent(); base.ModelItem = ownerActivity; base.Context = ownerActivity.GetEditingContext(); this.InitializeRadioButton("SelectColumnsMode", RemoveColumnsRadio); this.InitializeRadioButton("FilterRowsMode", RemoveRowsRadio); this.InitializeFilters(); if (this.Filters.Count == 0) { FilterOperationViewModel item = new FilterOperationViewModel { Operator = FilterOperator.LT, LogicalOperator = BooleanOperator.And }; this.Filters.Add(item); } this.UpdateFilterIndex(0); this.InitializeSelectColumns(); if (this.SelectColumns.Count == 0) { this.SelectColumns.Add(new SelectColumnViewModel()); } this.UpdateSelectColumnIndex(0); }
public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource) { ModelPropertyEntryToOwnerActivityConverter propertyEntryConverter = new ModelPropertyEntryToOwnerActivityConverter(); ModelItem modelItem = (ModelItem)propertyEntryConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null); EditingContext context = modelItem.GetEditingContext(); this.ShowDialog(modelItem, context); }
public bool Initialize(ModelItem modelItem) { this.baseModelItem = modelItem; if (null != modelItem) { this.context = modelItem.GetEditingContext(); } return(null != this.baseModelItem); }
public static void OnDeleteAnnotationCommandExecuted(ExecutedRoutedEventArgs e, ModelItem modelItem) { using (ModelEditingScope editingScope = modelItem.BeginEdit(SR.DeleteAnnotationDescription)) { modelItem.Properties[Annotation.AnnotationTextPropertyName].SetValue(null); ViewStateService viewStateService = modelItem.GetEditingContext().Services.GetService <ViewStateService>(); viewStateService.StoreViewStateWithUndo(modelItem, Annotation.IsAnnotationDockedViewStateName, null); editingScope.Complete(); } e.Handled = true; }
/** * constructor takes modelItem to connect the values changed to the activity, * this is the only way to affect the activity's values. */ public Wizard(ModelItem modelItem) { InitializeComponent(); this.ModelItem = modelItem; this.Context = modelItem.GetEditingContext(); loadedValues.Items.Add(_nothingLoaded); //loadedValues.Items.Add(_nothingLoaded); //defaultItem.IsSelected = true; //defaultItem.IsEnabled = true; //loadedValues.SelectedValue = _nothingLoaded.Value; }
public void UpdateDesigner() { EditingContext editingContext = _originalModelItem.GetEditingContext(); DesignerView designerView = editingContext.Services.GetService <DesignerView>(); if ((designerView.RootDesigner != null) && (((WorkflowViewElement)designerView.RootDesigner).ModelItem == _originalModelItem)) { designerView.MakeRootDesigner(_newModelItem); } Selection.SelectOnly(editingContext, _newModelItem); }
public NewColumnDialog(ModelItem ownerActivity, DataTable dataTable) { this._isEdit = false; this.WindowTitle = "新增数据表列"; this._dataTable = dataTable; this.MaxLength = -1; this.DateType = typeof(string); this.AllowDBNull = true; this.Context = ownerActivity.GetEditingContext(); this.InitializeComponent(); //this.TypePresenter.Context = ownerActivity.GetEditingContext(); }
public ConnectionDialog(ModelItem modelItem) { ProviderNames = new List <string>(); var installedProviders = DbProviderFactories.GetFactoryClasses(); foreach (DataRow installedProvider in installedProviders.Rows) { ProviderNames.Add(installedProvider["InvariantName"] as string); } InitializeComponent(); this.ModelItem = modelItem; this.Context = modelItem.GetEditingContext(); }
public PythonScriptEditorDialog(ModelItem ownerActivity) { base.ModelItem = ownerActivity; base.Context = ownerActivity.GetEditingContext(); InitializeComponent(); textEditor.Text = base.ModelItem.Properties["Code"].ComputedValue as string; //Python语法高亮 XmlTextReader xshd_reader = new XmlTextReader(new MemoryStream(Properties.Resources.Python_Mode)); textEditor.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.Load(xshd_reader, ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance); xshd_reader.Close(); }
public object Convert(object value, Type targetType, object parameter, Globalization.CultureInfo culture) { ModelItem modelItem = value as ModelItem; if (modelItem != null) { EditingContext editingContext = modelItem.GetEditingContext(); if (editingContext != null) { return(editingContext.Services.GetService <DesignerConfigurationService>().AnnotationEnabled); } } return(false); }
public static void AddSupportForUpdatingTypeArgument(ModelItem modelItem) { var argTypes = modelItem.ItemType.GetGenericArguments(); if (argTypes.Length == 0) { return; } var service = modelItem.GetEditingContext().Services.GetService <AttachedPropertiesService>(); for (int argIndex = 0; argIndex < argTypes.Length; argIndex++) { ExposeArgumentTypeForUpdate(modelItem, service, argIndex, argTypes.Length); } }
public NewColumnDialog(ModelItem ownerActivity, DataColumn dataColumn) { this.dataColumn = dataColumn; this.ColumnName = dataColumn.ColumnName; this.DateType = dataColumn.DataType; this.AllowDBNull = dataColumn.AllowDBNull; this.AutoIncrement = dataColumn.AutoIncrement; this.Unique = dataColumn.Unique; this.DefaultValue = dataColumn.DefaultValue; this.MaxLength = dataColumn.MaxLength; this.AutoIncrementSeed = dataColumn.AutoIncrementSeed; this.AutoIncrementStep = dataColumn.AutoIncrementStep; this.InitializeComponent(); this.TypePresenter.Context = ownerActivity.GetEditingContext(); }
public JoinDataTablesWizard(ModelItem ownerActivity) { Arguments = new ObservableCollection <JoinOperationViewModel>(); this.InitializeComponent(); base.ModelItem = ownerActivity; base.Context = ownerActivity.GetEditingContext(); this.InitalizeJoinType(); this.InitializeArguments(); if (this.Arguments.Count == 0) { this.Arguments.Add(new JoinOperationViewModel { Operator = JoinOperator.LT, LogicalOperator = BooleanOperator.And }); } this.UpdateArgumentIndex(0); }
public NewColumnDialog(ModelItem ownerActivity, DataTable dataTable, int columnIndex) { this._columnIndex = columnIndex; this._isEdit = true; this.WindowTitle = "编辑数据表列"; this._dataTable = dataTable; DataColumn dataColumn = this._dataTable.Columns[this._columnIndex]; this.AllowDBNull = dataColumn.AllowDBNull; this.Unique = dataColumn.Unique; this.AutoIncrement = dataColumn.AutoIncrement; this.ColumnName = dataColumn.ColumnName; this.DateType = dataColumn.DataType; this.MaxLength = dataColumn.MaxLength; this.DefaultValue = dataColumn.DefaultValue; this.Context = ownerActivity.GetEditingContext(); this.InitializeComponent(); //this.TypePresenter.Context = ownerActivity.GetEditingContext(); }
public static void Attach(ModelItem modelItem, Int32 maximumUpdatableTypes) { Type[] genericArguments = modelItem.ItemType.GetGenericArguments(); if (genericArguments.Any() == false) { return; } Int32 argumentCount = genericArguments.Length; Int32 updatableArgumentCount = Math.Min(argumentCount, maximumUpdatableTypes); EditingContext context = modelItem.GetEditingContext(); AttachedPropertiesService attachedPropertiesService = context.Services.GetService <AttachedPropertiesService>(); for (Int32 index = 0; index < updatableArgumentCount; index++) { AttachUpdatableArgumentType(modelItem, attachedPropertiesService, index, updatableArgumentCount); } }
private static void UpdateTypeArgument(ModelItem modelItem, Type argType, int argIndex) { if (modelItem == null) { return; } var argTypes = modelItem.ItemType.GetGenericArguments(); argTypes[argIndex] = argType; var editingContext = modelItem.GetEditingContext(); var itemType = modelItem.ItemType; var type = itemType.GetGenericTypeDefinition().MakeGenericType(argTypes); var newModelItem = ModelFactory.CreateItem(editingContext, Activator.CreateInstance(type)); MorphHelper.MorphObject(modelItem, newModelItem); MorphHelper.MorphProperties(modelItem, newModelItem); if (itemType.IsSubclassOf(typeof(Activity)) && type.IsSubclassOf(typeof(Activity)) && string.Equals((string)modelItem.Properties[DisplayName].ComputedValue, GetActivityDefaultName(itemType), StringComparison.Ordinal)) { newModelItem.Properties[DisplayName].SetValue(GetActivityDefaultName(type)); } var service = editingContext.Services.GetService <DesignerView>(); if (service == null) { return; } Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => { if (service.RootDesigner != null && ((WorkflowViewElement)service.RootDesigner).ModelItem == modelItem) { service.MakeRootDesigner(newModelItem); } Selection.SelectOnly(editingContext, newModelItem); })); }
public VBNetCodeEditorDialog(ModelItem ownerActivity) { base.ModelItem = ownerActivity; base.Context = ownerActivity.GetEditingContext(); InitializeComponent(); textEditor.Text = base.ModelItem.Properties["Code"].ComputedValue as string; Dictionary <string, Argument> args = base.ModelItem.Properties["Arguments"]?.ComputedValue as Dictionary <string, Argument>; m_codeHeader = GetCodeHeader(args); m_codeFooter = GetCodeFooter(); textEditor.TextArea.TextEntering += TextArea_TextEntering; textEditor.TextArea.TextEntered += TextArea_TextEntered; textEditor.TextArea.GotFocus += TextArea_GotFocus; foreach (var arg in args) { variableDeclarations.Add(arg.Key); } }
public static void ShowDialog(string propertyName, ModelItem ownerActivity) { DynamicArgumentDesignerOptions options = new DynamicArgumentDesignerOptions() { Title = propertyName }; ModelItem modelItem = ownerActivity.Properties[propertyName].Value; using (ModelEditingScope change = modelItem.BeginEdit(propertyName + "Editing")) { if (DynamicArgumentDialog.ShowDialog(ownerActivity, modelItem, ownerActivity.GetEditingContext(), ownerActivity.View, options)) { change.Complete(); } else { change.Revert(); } } }
public static void ShowDialog(string propertyName, ModelItem ownerActivity) { DynamicArgumentDesignerOptions options = new DynamicArgumentDesignerOptions { Title = propertyName }; ModelItem collection = ownerActivity.Properties[propertyName].Collection; using (ModelEditingScope modelEditingScope = collection.BeginEdit(propertyName + "Editing")) { if (DynamicArgumentDialog.ShowDialog(ownerActivity, collection, ownerActivity.GetEditingContext(), ownerActivity.View, options)) { modelEditingScope.Complete(); } else { modelEditingScope.Revert(); } } }
public static object ActivityFuncMorphHelper(ModelItem originalValue, ModelProperty newModelProperty) { Fx.Assert(newModelProperty.PropertyType.GetGenericArguments().Count() == 2, "This should only be applied for ActivityFunc<TArgument, TResult>"); Type activityFuncArgumentType = newModelProperty.PropertyType.GetGenericArguments()[0]; Type activityFuncResultType = newModelProperty.PropertyType.GetGenericArguments()[1]; Type activityFuncType = typeof(ActivityFunc <,>).MakeGenericType(activityFuncArgumentType, activityFuncResultType); object activityFunc = Activator.CreateInstance(activityFuncType); ModelItem morphed = ModelFactory.CreateItem(originalValue.GetEditingContext(), activityFunc); ModelItem originalActivityFuncArgument = originalValue.Properties[PropertyNames.ActionArgument].Value; if (originalActivityFuncArgument != null) { Type argumentType = typeof(DelegateInArgument <>).MakeGenericType(activityFuncArgumentType); DelegateInArgument newActivityActionArgument = (DelegateInArgument)Activator.CreateInstance(argumentType); newActivityActionArgument.Name = (string)originalActivityFuncArgument.Properties[PropertyNames.NameProperty].Value.GetCurrentValue(); morphed.Properties[PropertyNames.ActionArgument].SetValue(newActivityActionArgument); } ModelItem originalActivityFuncResult = originalValue.Properties[PropertyNames.ResultProperty].Value; if (originalActivityFuncResult != null) { Type resultType = typeof(DelegateOutArgument <>).MakeGenericType(activityFuncResultType); DelegateOutArgument newActivityActionResult = (DelegateOutArgument)Activator.CreateInstance(resultType); newActivityActionResult.Name = (string)originalActivityFuncResult.Properties[PropertyNames.NameProperty].Value.GetCurrentValue(); morphed.Properties[PropertyNames.ResultProperty].SetValue(newActivityActionResult); } ModelItem originalActivityActionHandler = originalValue.Properties[PropertyNames.ActionHandler].Value; if (originalActivityActionHandler != null) { morphed.Properties[PropertyNames.ActionHandler].SetValue(originalActivityActionHandler); originalValue.Properties[PropertyNames.ActionHandler].SetValue(null); } return(morphed); }
// Setup the grid that will be used for selection in the pop-up dialog public DataGridDialog(ModelItem modelItem, DataGrid designerGrid) { InitializeComponent(); List <GridRow> myRow = new List <GridRow>() { new GridRow() { Column1 = "", Column2 = "", Column3 = "", Column4 = "", Column5 = "", Column6 = "" }, new GridRow() { Column1 = "", Column2 = "", Column3 = "", Column4 = "", Column5 = "", Column6 = "" }, new GridRow() { Column1 = "", Column2 = "", Column3 = "", Column4 = "", Column5 = "", Column6 = "" }, new GridRow() { Column1 = "", Column2 = "", Column3 = "", Column4 = "", Column5 = "", Column6 = "" }, new GridRow() { Column1 = "", Column2 = "", Column3 = "", Column4 = "", Column5 = "", Column6 = "" }, new GridRow() { Column1 = "", Column2 = "", Column3 = "", Column4 = "", Column5 = "", Column6 = "" }, }; dgSimple.ItemsSource = myRow; this.ModelItem = modelItem; this.Context = ModelItem.GetEditingContext(); this.myDesignerGrid = designerGrid; }
static void OnRootPropertyChanged(object sender, PropertyChangedEventArgs e) { ModelItem rootModel = sender as ModelItem; Fx.Assert(rootModel != null, "sender item could not be null"); ModelProperty changedProperty = rootModel.Properties[e.PropertyName]; if (changedProperty == null) { return; } object changedPropertyValue = changedProperty.ComputedValue; if (changedPropertyValue == null) { return; } Fx.Assert(rootModel.GetCurrentValue().GetType() == WorkflowServiceType, "This handler should only be attached when the root is WorkflowService"); IDebuggableWorkflowTree root = rootModel.GetCurrentValue() as IDebuggableWorkflowTree; Activity rootActivity = root.GetWorkflowRoot(); if (rootActivity == changedPropertyValue) { if (WorkflowDesigner.GetTargetFramework(rootModel.GetEditingContext()).IsLessThan45()) { VisualBasicSettings settings = VisualBasic.GetSettings(root); NamespaceHelper.SetVisualBasicSettings(changedPropertyValue, settings); } else { IList <AssemblyReference> referencedAssemblies; IList <string> namespaces = NamespaceHelper.GetTextExpressionNamespaces(root, out referencedAssemblies); NamespaceHelper.SetTextExpressionNamespaces(rootActivity, namespaces, referencedAssemblies); } } }