protected override void OnLoad(EventArgs e) { base.OnLoad(e); SuspendLayout(); this.surface = new PreviewDesignSurface(this.parent.serviceProvider); PreviewWorkflowDesignerLoader loader = new PreviewWorkflowDesignerLoader(); this.surface.BeginLoad(loader); //Add the root activity IDesignerHost host = this.surface.GetService(typeof(IDesignerHost)) as IDesignerHost; Debug.Assert(host != null); // Activity rootDecl = host.CreateComponent(Type.GetType(DesignerHelpers.SequentialWorkflowTypeRef)) as Activity; rootDecl.Name = "ThemeSequentialWorkflow"; WorkflowDesignerLoader.AddActivityToDesigner(this.surface, rootDecl as Activity); //Create the readonly workflow ReadonlyWorkflow workflowView = new ReadonlyWorkflow(this.parent, this.surface as IServiceProvider); workflowView.TabStop = false; workflowView.Dock = DockStyle.Fill; Controls.Add(workflowView); host.Activate(); ResumeLayout(true); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); base.SuspendLayout(); this.surface = new PreviewDesignSurface(this.parent.serviceProvider); PreviewWorkflowDesignerLoader loader = new PreviewWorkflowDesignerLoader(); this.surface.BeginLoad(loader); IDesignerHost service = this.surface.GetService(typeof(IDesignerHost)) as IDesignerHost; Activity activity = service.CreateComponent(System.Type.GetType("System.Workflow.Activities.SequentialWorkflowActivity, System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")) as Activity; activity.Name = "ThemeSequentialWorkflow"; WorkflowDesignerLoader.AddActivityToDesigner(this.surface, activity); ReadonlyWorkflow workflow = new ReadonlyWorkflow(this.parent, this.surface) { TabStop = false, Dock = DockStyle.Fill }; base.Controls.Add(workflow); service.Activate(); base.ResumeLayout(true); }