public WorkflowDebuggerBase(TextWriter output, string workflowName, WorkflowDesigner workflowDesigner, bool disableDebugViewOutput) { this.output = output; this.workflowDesigner = workflowDesigner; this.workflowName = workflowName; this.debugView = new DataGrid(); this.debugView.IsReadOnly = true; this.debugView.SelectionMode = DataGridSelectionMode.Single; this.debugView.SelectionChanged += delegate(object sender, SelectionChangedEventArgs args) { this.HighlightActivity(this.debugView.SelectedIndex); }; this.disableDebugViewOutput = disableDebugViewOutput; this.debugTraceSource = new TraceSource(Path.GetFileNameWithoutExtension(workflowName) + "Debug"); this.allDebugTraceSource = new TraceSource("AllDebug"); ConfigurationManager.RefreshSection("appSettings"); string pauseBetweenDebugStepsInMillisecondsValue = ConfigurationManager.AppSettings["PauseBetweenDebugStepsInMilliseconds"]; if (!string.IsNullOrEmpty(pauseBetweenDebugStepsInMillisecondsValue)) { this.pauseBetweenDebugStepsInMilliseconds = int.Parse(pauseBetweenDebugStepsInMillisecondsValue); } }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); // register metadata (new DesignerMetadata()).Register(); RegisterCustomMetadata(); // add custom activity to toolbox Toolbox.Categories.Add(new ToolboxCategory("NeoComp Activities")); Toolbox.Categories[1].Add(new ToolboxItemWrapper(typeof(ComputationContext))); Toolbox.Categories[1].Add(new ToolboxItemWrapper(typeof(WiredNeuralNetworkBlueprint))); Toolbox.Categories[1].Add(new ToolboxItemWrapper(typeof(WeightDecayBlueprint))); Toolbox.Categories[1].Add(new ToolboxItemWrapper(typeof(GradientDescentRuleBlueprint))); Toolbox.Categories[1].Add(new ToolboxItemWrapper(typeof(LearningRuleCollectionBlueprint))); Toolbox.Categories[1].Add(new ToolboxItemWrapper(typeof(LinearActivationFunctionBlueprint))); Toolbox.Categories[1].Add(new ToolboxItemWrapper(typeof(SigmoidActivationFunctionBlueprint))); Toolbox.Categories[1].Add(new ToolboxItemWrapper(typeof(ActivationNeuronFactoryBlueprint))); Toolbox.Categories[1].Add(new ToolboxItemWrapper(typeof(UnorderedBatcher))); // create the workflow designer WorkflowDesigner wd = new WorkflowDesigner(); wd.Load(new Sequence()); DesignerBorder.Child = wd.View; PropertyBorder.Child = wd.PropertyInspectorView; }
//构造函数 public designerDebugTracking(WorkflowDesigner designer) { //(1) this.designer = designer; this.debugService = designer.DebugManagerView as DebuggerService; ; //(2) TrackingProfile TrackingProfile trackingProfile = new TrackingProfile(); ActivityStateQuery activityStateQuery = new ActivityStateQuery() { ActivityName = "*", States = { System.Activities.Tracking.ActivityStates.Executing }, Variables = { "*" }, Arguments = { "*" } }; trackingProfile.Queries.Add(activityStateQuery); this.TrackingProfile = trackingProfile; //(3) clearTrackInfo(); //(4) sourceLocationList = getSourceLocationMap(); activityMapList = getActivityMapList(sourceLocationList); } //end
public Designer() { InitializeComponent(); EditingScopes = new ObservableCollection<ModelEditingScope>(); workflowDesigner = new WorkflowDesigner(); this.DataContext = this; (new DesignerMetadata()).Register(); workflowDesigner.Load(new Sequence { Activities = { new If { Then = new Sequence { Activities = { new Persist(), new WriteLine { Text = "foo" } } } } } }); Grid.SetColumn(workflowDesigner.View, 1); Grid.SetColumn(workflowDesigner.PropertyInspectorView, 2); ApplicationGrid.Children.Add(workflowDesigner.View); ApplicationGrid.Children.Add(workflowDesigner.PropertyInspectorView); }
public WorkflowViewModel(bool disableDebugViewOutput) { this.workflowDesigner = new WorkflowDesigner(); this.id = ++designerCount; this.validationErrors = new List<ValidationErrorInfo>(); this.validationErrorService = new ValidationErrorService(this.validationErrors); this.workflowDesigner.Context.Services.Publish<IValidationErrorService>(this.validationErrorService); this.workflowDesigner.ModelChanged += delegate(object sender, EventArgs args) { this.modelChanged = true; this.OnPropertyChanged("DisplayNameWithModifiedIndicator"); }; this.validationErrorsView = new ValidationErrorsUserControl(); this.outputTextBox = new TextBox(); this.output = new TextBoxStreamWriter(this.outputTextBox, this.DisplayName); this.disableDebugViewOutput = disableDebugViewOutput; this.workflowDesigner.Context.Services.GetService<DesignerConfigurationService>().TargetFrameworkName = new System.Runtime.Versioning.FrameworkName(".NETFramework", new Version(4, 5)); this.workflowDesigner.Context.Services.GetService<DesignerConfigurationService>().LoadingFromUntrustedSourceEnabled = bool.Parse(ConfigurationManager.AppSettings["LoadingFromUntrustedSourceEnabled"]); this.validationErrorService.ErrorsChangedEvent += delegate(object sender, EventArgs args) { DispatcherService.Dispatch(() => { this.validationErrorsView.ErrorsDataGrid.ItemsSource = this.validationErrors; this.validationErrorsView.ErrorsDataGrid.Items.Refresh(); }); }; }
/// <summary> /// Attempt to warn the user if he is relying on unsigned assemblies in his workflow (an unsupported scenario). /// There are cases we won't catch though that the C# compiler will, involving generics like /// Variable of List of List of TypeFromUnsignedAssembly /// </summary> /// <param name="project">Project for the compile operation</param> public static HashSet<Assembly> GetReferencedAssemblies(WorkflowDesigner workflowDesigner, IEnumerable<Type> referencedTypes) { HashSet<Assembly> referencedAssemblies = new HashSet<Assembly>(); //Get the assemblies referenced in the workflow. //We are shrinking the enumeration of types, as different types can come from one assembly IEnumerable<Assembly> assemblies = referencedTypes .Where(baseType => null != baseType) .Select(baseType => baseType.Assembly); if (assemblies.Any()) { referencedAssemblies.UnionWith(assemblies); } // XamlBuildTask is unpredictable about which assemblies it needs referenced, but currently loaded assemblies in the AppDomain // should be sufficient (since the XAML-ified object is actually present in memory in this AppDomain). However, any assembly // referenced here will become a XAML dependency of the compiled workflow so we want to keep the set as small as we can. // Therefore, we take the intersection of (loaded assemblies) X (reference closure of assembliesUsedDirectly). // Use Caching if possible to include XAML dependencies, but merge with reflected dependencies to pick up // built-in dependencies (which aren't stored in the DB or in ActivityAssemblyItems). AddReferencesInApplicationDomain(referencedAssemblies); return referencedAssemblies; }
/// <summary> /// Setup WorkflowDesigner when add a composite activity /// </summary> public static WorkflowDesigner CreateWorkflowDesigner(Activity activity, string name) { ActivityBuilder workflow = CreateWorkflow(activity, name); WorkflowDesigner newWorkflowDesigner = new WorkflowDesigner(); SetupWorkflowDesignerRefernce(newWorkflowDesigner); newWorkflowDesigner.Load(workflow); // initialize workflow based on Text property return newWorkflowDesigner; }
private void Button_Click(object sender, RoutedEventArgs e) { wd = new WorkflowDesigner(); wd.Load(ReturnSequence()); Grid.SetColumn(wd.PropertyInspectorView, 1); windowGrid.Children.Add(wd.PropertyInspectorView); treeView1.DataContext = new List<ModelItem> { wd.Context.Services.GetService<ModelService>().Root }; ChangeButton.IsEnabled = true; }
private static void ConvertNamespaces(object root, EditingContext context) { VisualBasicSettings settings = VisualBasic.GetSettings(root); IList <AssemblyReference> references; IList <string> importedNamespaces = NamespaceHelper.GetTextExpressionNamespaces(root, out references); FrameworkName targetFramework = WorkflowDesigner.GetTargetFramework(context); if (targetFramework.IsLessThan45()) { if (settings == null) { if ((importedNamespaces != null) && (importedNamespaces.Count > 0)) { NamespaceHelper.ConvertToVBSettings( importedNamespaces, references, context, out settings); } else { settings = new VisualBasicSettings(); } NamespaceHelper.SetVisualBasicSettings(root, settings); NamespaceHelper.SetTextExpressionNamespaces(root, null, null); } IDebuggableWorkflowTree debuggableWorkflowTree = root as IDebuggableWorkflowTree; if (debuggableWorkflowTree != null) { Activity rootActivity = debuggableWorkflowTree.GetWorkflowRoot(); if (rootActivity != null) { NamespaceHelper.SetVisualBasicSettings(rootActivity, settings); NamespaceHelper.SetTextExpressionNamespaces(rootActivity, null, null); } } } else { if ((importedNamespaces == null) || (importedNamespaces.Count == 0)) { if (settings != null) { NamespaceHelper.ConvertToTextExpressionImports(settings, out importedNamespaces, out references); NamespaceHelper.SetTextExpressionNamespaces(root, importedNamespaces, references); NamespaceHelper.SetVisualBasicSettings(root, null); } else { NamespaceHelper.SetTextExpressionNamespaces(root, new Collection <string>(), new Collection <AssemblyReference>()); } } } }
private void InitializeDesigner() { //Create a designer workflowDesigner = new WorkflowDesigner(); workflowDesigner.ModelChanged += new EventHandler(workflowDesigner_ModelChanged); designerArea.Child = workflowDesigner.View; //Error service workflowDesigner.Context.Services.Publish<IValidationErrorService>(errorService); }
/// <summary> /// Creates a new Workflow Designer instance /// </summary> /// <param name="sourceFile">Workflow FileName</param> public static void NewInstance(string sourceFile = _defaultWorkflow) { _wfDesigner = new WorkflowDesigner(); _wfDesigner.Context.Services.GetService<DesignerConfigurationService>().TargetFrameworkName = new System.Runtime.Versioning.FrameworkName(".NETFramework", new Version(4, 5)); _wfDesigner.Context.Services.GetService<DesignerConfigurationService>().LoadingFromUntrustedSourceEnabled = true; //associates all of the basic activities with their designers (new DesignerMetadata()).Register(); //load Workflow Xaml _wfDesigner.Load(sourceFile); }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); // register metadata (new DesignerMetadata()).Register(); // create the workflow designer WorkflowDesigner wd = new WorkflowDesigner(); wd.Load(new Sequence()); DesignerBorder.Child = wd.View; PropertyBorder.Child = wd.PropertyInspectorView; }
public static IEnumerable<ModelItem> FindTaskActivity(WorkflowDesigner workflowDesigner) { Contract.Requires(workflowDesigner != null); var root = workflowDesigner.GetRoot(); if (root != null) return ModelItemService.Find( root, (modelItemType) => typeof(TaskActivity).IsAssignableFrom(modelItemType)); return new List<ModelItem>(); }
public static IEnumerable<ModelItem> getSelectActivityList(WorkflowDesigner designer) { foreach (var v in designer.Context.Items) { Selection selection = v as Selection; if (selection != null) { return selection.SelectedObjects; } } return null; }
private void AddDesigner() { //Create an instance of WorkflowDesigner class. this._wd = new WorkflowDesigner(); //Place the designer canvas in the middle column of the grid. Grid.SetColumn(this._wd.View, 1); //Load a new Sequence as default. this._wd.Load(new Sequence()); //Add the designer canvas to the grid. grid1.Children.Add(this._wd.View); }
public static void AddReferenceAssemblies(WorkflowDesigner workflowDesigner, IEnumerable<AssemblyName> referenceAssemblies) { Contract.Requires(workflowDesigner != null); Contract.Requires(referenceAssemblies != null); AssemblyContextControlItem assemblyContext = workflowDesigner.Context.Items.GetValue<AssemblyContextControlItem>(); foreach(var asm in referenceAssemblies) { if (!IsContainAssembleName(assemblyContext.ReferencedAssemblyNames, asm)) { assemblyContext.ReferencedAssemblyNames.Add(asm); } } workflowDesigner.Context.Items.SetValue(assemblyContext); }
public static void FinishTaskAssigned(WorkflowDesigner designer) { Contract.Requires(designer != null); CompositeService.UpdateModelItem(FindTaskActivity(designer).ToDictionary( m => m, m => { var task = m.GetTaskActivity(); if (task.Status == TaskActivityStatus.New && !string.IsNullOrEmpty(task.Alias)) { m.Properties["Status"].SetValue(TaskActivityStatus.Assigned); } return new TaskActivity(task.Group, task.Alias, task.TaskId, task.TaskBody, task.Status, task.DisplayName) as Activity; })); }
} //end //加载流程 void loadWorkflowFromFile(string workflowFilePathName) { desienerPanel.Content = null; propertyPanel.Content = null; designer = new WorkflowDesigner(); try { designer.Load(workflowFilePathName); modelService = designer.Context.Services.GetService<ModelService>(); rootModelItem = modelService.Root; undoEngine = designer.Context.Services.GetService<UndoEngine>(); undoEngine.UndoUnitAdded += delegate(object ss, UndoUnitEventArgs ee) { designer.Flush(); //调用Flush使designer.Text得到数据 desigeerActionList.Items.Add(string.Format("{0} , {1}", DateTime.Now.ToString(), ee.UndoUnit.Description)); }; designerView = designer.Context.Services.GetService<DesignerView>(); designerView.WorkflowShellBarItemVisibility = ShellBarItemVisibility.Arguments //如果不使用Activity做根,无法出现参数选项 | ShellBarItemVisibility.Imports | ShellBarItemVisibility.MiniMap | ShellBarItemVisibility.Variables | ShellBarItemVisibility.Zoom ; desienerPanel.Content = designer.View; propertyPanel.Content = designer.PropertyInspectorView; } catch (SystemException ex) { MessageBox.Show(ex.Message); } } //end
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); // register metadata (new DesignerMetadata()).Register(); RegisterCustomMetadata(); // add custom activity to toolbox Toolbox.Categories.Add(new ToolboxCategory("Custom activities")); Toolbox.Categories[1].Add(new ToolboxItemWrapper(typeof(SimpleNativeActivity))); // create the workflow designer WorkflowDesigner wd = new WorkflowDesigner(); wd.Load(new Sequence()); DesignerBorder.Child = wd.View; PropertyBorder.Child = wd.PropertyInspectorView; }
public WorkflowEditor() { var dm = new DesignerMetadata(); dm.Register(); Designer = new WorkflowDesigner(); Designer.Load(new Sequence()); Content = Designer.View; IsSelectedChanged += (sender, args) => { HandleSelectionChanged(); }; IsActiveChanged += (sender, args) => { HandleSelectionChanged(); }; }
/// <summary> /// The add designer. /// </summary> private void AddDesigner() { // Create an instance of WorkflowDesigner class this.workflowDesigner = new WorkflowDesigner(); // Place the WorkflowDesigner in the middle column of the grid Grid.SetColumn(this.workflowDesigner.View, 1); // Show the XAML when the model changes this.workflowDesigner.ModelChanged += this.ShowWorkflowXaml; // Load a new Sequence as default. this.workflowDesigner.Load(HttpWorkflowServiceFactory.Create()); // new HttpWorkflowService() // { // Body = new Sequence() // { // Activities = // { // new HttpReceive() // { // DisplayName = "HttpReceive", // CanCreateInstance = true, // Method = "GET", // UriTemplate = "/{Id}" // } // } // } // } // ); // Add the WorkflowDesigner to the grid this.grid1.Children.Add(this.workflowDesigner.View); // Add the Property Inspector Grid.SetColumn(this.workflowDesigner.PropertyInspectorView, 2); this.grid1.Children.Add(this.workflowDesigner.PropertyInspectorView); // Add the toolbox ToolboxControl tc = CreateToolbox(); Grid.SetColumn(tc, 0); this.grid1.Children.Add(tc); // Show the initial XAML this.ShowWorkflowXaml(null, null); }
void loadWorkflowFromFile(string workflowFilePathName) { desienerPanel.Content = null; designer = new WorkflowDesigner(); try { designer.Load(workflowFilePathName); desienerPanel.Content = designer.View; } catch (SystemException ex) { MessageBox.Show(ex.Message); } }
static public void PreviewLoadRoot(object sender, WorkflowDesigner.PreviewLoadEventArgs args) { object root = args.Instance; DesignerConfigurationService configService = args.Context.Services.GetService<DesignerConfigurationService>(); if (configService != null && configService.NamespaceConversionEnabled) { ConvertNamespaces(root, args.Context); } if (root.GetType() == WorkflowServiceType) { args.Context.Services.Subscribe<ModelTreeManager>(manager => manager.Root.PropertyChanged += new PropertyChangedEventHandler(OnRootPropertyChanged)); } TypeDescriptor.AddProvider(new RootModelTypeDescriptionProvider(root), root); }
public static HashSet<Type> GetReferencedTypes(WorkflowDesigner workflowDesigner) { HashSet<Type> referencedTypes = new HashSet<Type>(); ModelService modelService = workflowDesigner.GetModelService(); //Get types used in the activities of the workflow referencedTypes.UnionWith(modelService.Find(modelService.Root, typeof(object)).Select(item => item.GetCurrentValue().GetType())); //Add types referenced in the root (e.g. parameters) to the collection ActivityBuilder builder = modelService.Root.GetCurrentValue() as ActivityBuilder; if (builder != null) { referencedTypes.UnionWith(builder.Properties.Select(property => property.Type)); } //Add base types and types of the parameters of every type in the list referencedTypes.UnionWith(GetBaseAndArgumentTypes(referencedTypes)); return referencedTypes; }
public MainWindow() { InitializeComponent(); _designer = new WorkflowDesigner(); Loaded += (s, e) => Layout.Load(dockingManager); Closed += (s, e) => Layout.Save(dockingManager); DesignerMetadata dm = new DesignerMetadata(); dm.Register(); toolboxBorder.Child = ToolboxService.GetToolboxControl(); propertiesBorder.Child = _designer.PropertyInspectorView; outlineBorder.Child = _designer.OutlineView; designerBorder.Child = _designer.View; _designer.Load(new Sequence()); DataContext = new MainWindowViewModel(dockingManager, _designer); }
/// <summary> /// Default constructor, creates a hidden designer view and a property inspector /// </summary> public WpfPropertyGrid() { this.UniqueActivity = new DummyActivity(); this.Designer = new WorkflowDesigner(); Designer.PropertyInspectorView.Visibility = Visibility.Visible; Designer.View.Visibility = Windows.Visibility.Hidden; this.Children.Add(Designer.PropertyInspectorView); this.Children.Add(Designer.View); Designer.Load(this.UniqueActivity); this.RefreshMethod = Designer.PropertyInspectorView.GetType().GetMethod("RefreshPropertyList", Reflection.BindingFlags.NonPublic | Reflection.BindingFlags.Instance | Reflection.BindingFlags.DeclaredOnly); this.SelectionTypeLabel = this.Designer.PropertyInspectorView.GetType().GetMethod("get_SelectionTypeLabel", Reflection.BindingFlags.Public | Reflection.BindingFlags.NonPublic | Reflection.BindingFlags.Instance | Reflection.BindingFlags.DeclaredOnly).Invoke(Designer.PropertyInspectorView, new object[0]) as TextBlock; this.SelectionTypeLabel.Text = string.Empty; }
private void AddDesigner() { //Create an instance of WorkflowDesigner class. this.wd = new WorkflowDesigner(); //Place the designer canvas in the middle column of the grid. Grid.SetColumn(this.wd.View, 1); //Load a new Sequence as default. this.wd.Load(new Sequence()); var designerView = wd.Context.Services.GetService<DesignerView>(); designerView.WorkflowShellBarItemVisibility = ShellBarItemVisibility.Imports | ShellBarItemVisibility.MiniMap | ShellBarItemVisibility.Variables | ShellBarItemVisibility.Arguments | ShellBarItemVisibility.Zoom; //Add the designer canvas to the grid. WorkflowDesignerGrid.Children.Add(this.wd.View); }
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); } } }
public MainWindowViewModel(DockingManager dm, WorkflowDesigner wf) { SaveCommand = new DelegateCommand((o) => { var of = new SaveFileDialog(); of.Filter = "Workflow File (*.wf;*.xaml)|*.wf;*.xaml"; if (of.ShowDialog().Value) { wf.Save(of.FileName); } }, (o) => true); LoadCommand = new DelegateCommand((o) => { var of = new OpenFileDialog(); of.Filter = "Workflow File (*.wf;*.xaml)|*.wf;*.xaml"; if (of.ShowDialog().Value) { wf.Load(of.FileName); } }, (o) => true); }
static string GetXaml(WorkflowDesigner workflowDesigner, bool fullyQualifiedClrNamespaces, bool shoudCleanup) { Contract.Requires(workflowDesigner != null); var errorService = workflowDesigner.Context.IfNotNull(ctx => ctx.Services.GetService<IXamlLoadErrorService>() as Microsoft.Support.Workflow.Authoring.AddIns.ViewModels.WorkflowEditorViewModel.ErrorService); if (errorService.IfNotNull(err => err.HasXamlLoadErrors)) { // When XamlLoad errors occur, designer is read-only. Not safe to reserialize because ErrorActivity will lose information // about the original Xaml, so we return the XAML originally loaded. (This is probably because the user directly edited // the XAML to be incorrect. We should preserve what he wrote so he can fix it.) return workflowDesigner.Text; } object root = workflowDesigner.Context.Services.GetService<ModelService>().IfNotNull(modelService => modelService.Root) .IfNotNull(v => v.GetCurrentValue()); // Could be ActivityBuilder or Activity, or something else entirely actually if (root != null) { return shoudCleanup ? XamlService.SerializeToXamlWithCleanup(root, fullyQualifiedClrNamespaces: fullyQualifiedClrNamespaces) : XamlService.SerializeToXaml(root, fullyQualifiedClrNamespaces: fullyQualifiedClrNamespaces); } else { return string.Empty; } }
public void Debug() { if (IsExecuting || !Save(true)) { return; } // HACK ZONE // WorkflowDesigner have to be loaded all over again through WorkflowDesigner.Load(filepath) otherwise // SourceLocationProvider.CollectMapping() won't collect nothing later on WorkflowDebugger and // becaquse of that debug process won't work as expected. // Activities not loaded with WorkflowDesigner.Load(filepath) won't be recognized at all. // That's the only motive for the workflow to be saved before debug. // More info: http://social.msdn.microsoft.com/forums/en-us/wfprerelease/thread/2DEE4DD9-D3F7-4430-BCC7-D613859074D1 // http://social.msdn.microsoft.com/Forums/en/wfprerelease/thread/0a28cade-bd8d-417b-a1e4-efbc0d9ccd43 // http://blogs.msdn.com/b/tilovell/archive/2011/06/08/wf4-visual-workflow-tracking-and-workflowinspectionservices.aspx // This needs to be addressed by MS. Didn't test it on NET4.5 // Should check this in detail later WorkflowDesigner = new WorkflowDesigner(); WorkflowDesigner.Load(FilePath); // END OF HACK ZONE if (WorkflowType == WorkflowType.Activity) { executer = new ActivityDebugger(WorkflowDesigner, outputTextWriter); } else { executer = new WorkflowServiceDebugger(WorkflowDesigner, outputTextWriter); } ((IWorkflowDebugger) executer).DebugStepAdded += (sender, args) => { Application.Current.Dispatcher.Invoke( DispatcherPriority.Normal, (Action) (() => DebugSteps.Add(args.DebugStep))); }; executer.ExecutingStateChanged += OnExecuterRunningStateChanged; executer.Start(); }
private void InitializeWorkflowFileViewModel() { new DesignerMetadata().Register(); WorkflowDesigner = new WorkflowDesigner(); outputTextWriter = new EventableStringWriter(outputTextBuilder); outputTextWriter.TextChanged += (sender, args) => RaisePropertyChanged("OutputText"); Outline = new OutlineItemObservableCollection(); }
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); }