private void InitializeProfileDesigner(Type workflowType, TrackingProfile profile)
        {
            this.toolStrip1.Visible = true;
            if (workflowType != null)
            {
                profileManager = new TrackingProfileManager();
                if (profile != null)
                {
                    profileManager.TrackingProfile = profile;
                }
                this.workflowDesignerControl1.WorkflowType = workflowType;
            }

            this.workflowDesignerControl1.SelectionChanged += this.OnActivitySelected;

            //Once a workflow is loaded, ensure our glyph provider is added
            IDesignerGlyphProviderService glyphManager = this.workflowDesignerControl1.GetService(typeof(IDesignerGlyphProviderService)) as IDesignerGlyphProviderService;

            if (glyphManager == null)
            {
                MessageBox.Show("There was an error loading the workflow type " + workflowType.AssemblyQualifiedName);
                return;
            }
            glyphManager.AddGlyphProvider(new TrackingGlyphProvider(profileManager));

            WorkflowType = workflowType;
        }
Example #2
0
        protected override void Initialize(WorkflowView parentView)
        {
            base.Initialize(parentView);
            IServiceContainer container = base.GetService(typeof(IServiceContainer)) as IServiceContainer;

            if (container != null)
            {
                container.RemoveService(typeof(ConnectionManager));
                container.AddService(typeof(ConnectionManager), this);
            }
            IDesignerGlyphProviderService service = base.GetService(typeof(IDesignerGlyphProviderService)) as IDesignerGlyphProviderService;

            if (service != null)
            {
                service.AddGlyphProvider(this);
            }
        }
Example #3
0
        //Expand or collapse all composite activities

        static public byte[] GetWorkflowImageBinary(Activity workflowDefinition, Dictionary <string, ActivityStatusInfo> activityStatusList)
        {
            AutoResetEvent waitHandle = new AutoResetEvent(false);

            byte[] results = null;
            Thread thread  = new Thread(delegate()
            {
                Loader loader = new Loader();
                WorkflowDesignSurface surface = new WorkflowDesignSurface(new MemberCreationService());
                IDesignerHost host            = (IDesignerHost)surface.GetService(typeof(IDesignerHost));
                if (host == null)
                {
                    waitHandle.Set();
                    return;
                }
                loader.WorkflowDefinition = workflowDefinition;
                surface.BeginLoad(loader);
                if (activityStatusList != null)
                {
                    IDesignerGlyphProviderService glyphService         = surface.GetService(typeof(IDesignerGlyphProviderService)) as IDesignerGlyphProviderService;
                    WorkflowMonitorDesignerGlyphProvider glyphProvider = new WorkflowMonitorDesignerGlyphProvider(activityStatusList);
                    glyphService.AddGlyphProvider(glyphProvider);
                }
                ((IDesignerLoaderHost)host).EndLoad(host.RootComponent.Site.Name, true, null);
                IDesignerHost designerHost = surface.GetService(typeof(IDesignerHost)) as IDesignerHost;
                if (designerHost != null && designerHost.RootComponent != null)
                {
                    IRootDesigner rootDesigner = designerHost.GetDesigner(designerHost.RootComponent) as IRootDesigner;
                    if (rootDesigner != null)
                    {
                        MemoryStream ms           = new MemoryStream();
                        WorkflowView workflowView = rootDesigner.GetView(ViewTechnology.Default) as WorkflowView;
                        workflowView.SaveWorkflowImage(ms, ImageFormat.Png);
                        results = ms.GetBuffer();
                    }
                }
                waitHandle.Set();
            });

            thread.IsBackground = true;
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            waitHandle.WaitOne();
            return(results);
        }
        public void Highlight(List<ActivityDesigner> highlightedDesigners)
        {
            if (highlightedDesigners == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("hightlightedDesigners");
            }

            glyphProviderService = this.GetService(typeof(IDesignerGlyphProviderService)) as IDesignerGlyphProviderService;
            workflowView = GetService(typeof(WorkflowView)) as WorkflowView;

            RemoveCurrentHighlight();

            IDesignerHost designerHost = this.GetService(typeof(IDesignerHost)) as IDesignerHost;
            DesignerHighlighterMesageFilter messageFilter = new DesignerHighlighterMesageFilter();
            highlightProvider = new HighlightGlyphProvider(designerHost.GetDesigner(designerHost.RootComponent) as ActivityDesigner, highlightedDesigners);
            glyphProviderService.AddGlyphProvider(highlightProvider);
            highlightProvider.MessageFilter = messageFilter;

            messageFilter.MouseDown += new EventHandler<System.Windows.Forms.MouseEventArgs>(messageFilter_MouseDown);
            messageFilter.KeyDown += new EventHandler<System.Windows.Forms.KeyEventArgs>(messageFilter_KeyDown);
            workflowView.AddDesignerMessageFilter(messageFilter);
            workflowView.FitToScreenSize();
        }
Example #5
0
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             IServiceContainer container = base.GetService(typeof(IServiceContainer)) as IServiceContainer;
             if (container != null)
             {
                 container.RemoveService(typeof(ConnectionManager));
             }
             IDesignerGlyphProviderService service = base.GetService(typeof(IDesignerGlyphProviderService)) as IDesignerGlyphProviderService;
             if (service != null)
             {
                 service.RemoveGlyphProvider(this);
             }
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
Example #6
0
        //Loads the workflow definition into the designer
        internal void OpenWorkflow(Activity workflowDefinition)
        {
            Initialize();

            IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));

            if (host == null)
            {
                return;
            }

            if (this.workflowViewValue != null)
            {
                if (Controls.Contains(this.workflowViewValue))
                {
                    Controls.Remove(this.workflowViewValue);
                }
                this.workflowViewValue.Dispose();
                this.workflowViewValue = null;
            }

            loader.WorkflowDefinition = workflowDefinition;
            this.surface.BeginLoad(this.loader);

            this.workflowViewValue         = new WorkflowView(this.surface);
            workflowViewValue.ZoomChanged += new EventHandler(workflowViewValue_ZoomChanged);
            IDesignerGlyphProviderService        glyphService  = this.surface.GetService(typeof(IDesignerGlyphProviderService)) as IDesignerGlyphProviderService;
            WorkflowMonitorDesignerGlyphProvider glyphProvider = new WorkflowMonitorDesignerGlyphProvider(parentValue.ActivityStatusList);

            glyphService.AddGlyphProvider(glyphProvider);

            workflowViewValue.Dock = DockStyle.Fill;
            Controls.Add(workflowViewValue);

            ((IDesignerLoaderHost)host).EndLoad(host.RootComponent.Site.Name, true, null);
        }
        public void Highlight(List <ActivityDesigner> highlightedDesigners)
        {
            if (highlightedDesigners == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("hightlightedDesigners");
            }

            glyphProviderService = this.GetService(typeof(IDesignerGlyphProviderService)) as IDesignerGlyphProviderService;
            workflowView         = GetService(typeof(WorkflowView)) as WorkflowView;

            RemoveCurrentHighlight();

            IDesignerHost designerHost = this.GetService(typeof(IDesignerHost)) as IDesignerHost;
            DesignerHighlighterMesageFilter messageFilter = new DesignerHighlighterMesageFilter();

            highlightProvider = new HighlightGlyphProvider(designerHost.GetDesigner(designerHost.RootComponent) as ActivityDesigner, highlightedDesigners);
            glyphProviderService.AddGlyphProvider(highlightProvider);
            highlightProvider.MessageFilter = messageFilter;

            messageFilter.MouseDown += new EventHandler <System.Windows.Forms.MouseEventArgs>(messageFilter_MouseDown);
            messageFilter.KeyDown   += new EventHandler <System.Windows.Forms.KeyEventArgs>(messageFilter_KeyDown);
            workflowView.AddDesignerMessageFilter(messageFilter);
            workflowView.FitToScreenSize();
        }