public void RemoveCurrentHighlight()
        {
            HighlightGlyphProvider currentHightlightGlyhProvider = null;

            foreach (IDesignerGlyphProvider glyphProvider in glyphProviderService.GlyphProviders)
            {
                if (glyphProvider is HighlightGlyphProvider)
                {
                    currentHightlightGlyhProvider = (HighlightGlyphProvider)glyphProvider;
                    break;
                }
            }
            if (currentHightlightGlyhProvider != null)
            {
                //remove associated designerMessageFilter before removing currentGlyphProvider.
                workflowView.RemoveDesignerMessageFilter(currentHightlightGlyhProvider.MessageFilter);
                glyphProviderService.RemoveGlyphProvider(currentHightlightGlyhProvider);
            }
        }
        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();
        }
        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();
        }