Beispiel #1
0
        // Loads precreated workflow. The function is similar to the above function except
        // instead of creating an empty workflow we create workflow with contents
        internal void LoadDefaultWorkflow()
        {
            Clear();

            this.designSurface = new WorkflowDesignSurface(this);
            WorkflowLoader loader = new WorkflowLoader();

            this.designSurface.BeginLoad(loader);

            this.designerHost = GetService(typeof(IDesignerHost)) as IDesignerHost;
            if (this.designerHost != null)
            {
                this.rootActivity      = (SequentialWorkflowActivity)this.designerHost.CreateComponent(typeof(SequentialWorkflowActivity));
                this.rootActivity.Name = "Service1";

                CodeActivity codeActivity1 = new CodeActivity();
                this.rootActivity.Activities.Add(codeActivity1);
                this.designerHost.RootComponent.Site.Container.Add(codeActivity1);

                this.workflowView = new WorkflowView(this.designSurface as IServiceProvider);
                this.workflowView.AddDesignerMessageFilter(new CustomMessageFilter(this.designSurface as IServiceProvider, this.workflowView, loader));

                Controls.Add(this.workflowView);
                this.designerHost.Activate();

                ISelectionService selectionService = (ISelectionService)GetService(typeof(ISelectionService));
                if (selectionService != null)
                {
                    selectionService.SelectionChanged += new EventHandler(OnSelectionChanged);
                    IComponent[] selection = new IComponent[] { rootActivity };
                    selectionService.SetSelectedComponents(selection);
                }
            }
        }
Beispiel #2
0
        // Loads precreated workflow. The function is similar to the above function except
        // instead of creating an empty workflow we create workflow with contents
        internal void LoadDefaultWorkflow()
        {
            Clear();

            this.designSurface = new WorkflowDesignSurface(this);
            WorkflowLoader loader = new WorkflowLoader();
            this.designSurface.BeginLoad(loader);
            
            this.designerHost = GetService(typeof(IDesignerHost)) as IDesignerHost;
            if (this.designerHost != null)
            {
                this.rootActivity = (SequentialWorkflowActivity)this.designerHost.CreateComponent(typeof(SequentialWorkflowActivity));
                this.rootActivity.Name = "Service1";

                CodeActivity codeActivity1 = new CodeActivity();
                this.rootActivity.Activities.Add(codeActivity1);
                this.designerHost.RootComponent.Site.Container.Add(codeActivity1);

                this.workflowView = new WorkflowView(this.designSurface as IServiceProvider);
                this.workflowView.AddDesignerMessageFilter(new CustomMessageFilter(this.designSurface as IServiceProvider, this.workflowView, loader));

                Controls.Add(this.workflowView);
                this.designerHost.Activate();

                ISelectionService selectionService = (ISelectionService)GetService(typeof(ISelectionService));
                if (selectionService != null)
                {
                    selectionService.SelectionChanged += new EventHandler(OnSelectionChanged);
                    IComponent[] selection = new IComponent[] { rootActivity };
                    selectionService.SetSelectedComponents(selection);
                }
            }
        }