index > Windows Workflow Foundation > WF Designer: Glyph provider is not being used by my viewer

WF Designer: Glyph provider is not being used by my viewer

Hi all,

I have a web page that displays the workflow image for a given workflow instance id. I based this code on the WorkflowMonitor in the June CTP SDK. To avoid CAS issues, my workflowViewer saves the workflow image as a stream which is returned to the web page for rendering (as opposed to hosting a designer surface directly in a web page).

This is working fine, however I am unable to hook in the glyph provider to mark Closed and Executing activities, as is done in the SDK.

Here's the relevant code extract:

---

IDesignerGlyphProviderService glyphService = (IDesignerGlyphProviderService)designSurface.GetService(typeof(IDesignerGlyphProviderService));
WorkflowMonitorDesignerGlyphProvider glyphProvider = new WorkflowMonitorDesignerGlyphProvider(activityStatusListValue);
glyphService.AddGlyphProvider(glyphProvider);

using (workflowView = new WorkflowView(designSurface))
{
workflowView.Dock = DockStyle.Fill;
((IDesignerLoaderHost)designerHost).EndLoad(designerHost.RootComponent.Site.Name, true, null);
workflowView.SaveWorkflowImage(stream, imageInfo.ImageFormat);
}
return stream;

---

The WorkflowMonitorDesignerGlyphProvider is identical to the corresponding class in the SDK.

When I debug the SDK WorkflowMonitor I see that the IDesignerGlyphProvider.GetGlyphs in the Glyph provider is called at some point after the .EndLoad() call. However in my implementation, GetGlyphs is never called and I am trying to find out why?

I thought perhaps this is because I don't have a control container that my workflow viewer is added to. In my case I keep the workflow viewer in memory, save the workflow image as a stream, then dispose. I tried creating a temporary form control object and adding the workflowView to it to see if that would trigger the GetGlyphs call - but it didn't.

So, does anyone know what calls the GetGlyph method of the Glyph provider and how I might go about invoking this myself to mimic what happens in the win form environment.

Any and all help is greatly appreciated.

Thanks

Steve

Steve Nesbitt
Steve - I think workflowView.PerformLayout might be the thing you are looking for (although I am not 100% sure)


http://www.quicklearn.com/workflow.htm
Jon Flanders

A good suggestion, Jon, but sadly it didnt work for me. I tried adding that statement before and after the EndLoad() call.

Thanks

Steve

Steve Nesbitt
Do your glyphs work if your control is hosted in a windows form?


http://www.quicklearn.com/workflow.htm
Jon Flanders
Yes they do, and I have copied the same provider class into my web environment.
Steve Nesbitt
Feel free to send me the project - I'll try to see what the problem is


http://www.quicklearn.com/workflow.htm
Jon Flanders

Thanks very much Jon - I forwarded the project files to your gmail account.

Steve

Steve Nesbitt

I think I have traced it down to the fact that in a windows form enviornment the System.Workflow.ComponentModel.Design.WorkflowView object is added to a panel object, where as in the web environment I instantiated the WorkflowView object in memory and just used it to SaveWorkflowImage. I suspect that it is the Paint event of the panel that is firing the IDesignerGlyphProvider.GetGlyphs() method. I have tried creating an in memory panel object, adding the WorkflowView object to it and calling panel.Show(), but that doesnt work either. (Also tried panel.Refresh() and panel.PerformLayout()).

Does anyone know another way I can manually call the Paint event for a control?

Thanks

Steve

Steve Nesbitt
If anyone is following this thread to solve a similar problem, I tracked down my issue to the fact I was disposing the workflowDefinition too early.
Steve Nesbitt
reply 9

You can use google to search for other answers

 

More Articles

• CPU Usage more then 50% all the time!
• WorkflowCompiler - sign assembly
• Custom Activity in XAML
• Help with instantiating activity class object...
• IncludeDebugInformation not working
• correlation
• WorkflowCompleted event fires twice.
• load an activity using xoml
• Check For Existing WorkflowRuntime In Current AppDomain And More
• What does this exception message ["More than one service exi...
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• How can I query StateMachineWorkflowInst
• Changes between Beta 1 and Beta 2
• ASP.NET with beta 2.2
• sqltracking and sqlpersistenceservice
• Any New ASP.NET/WF Functionality for Tec
• SqlTrackingService Beta 2 Lab 03 exercis
• WF failed to work, if i add a service
• WinFx Installtion problem
• Retreive workflow properties
• Error while executing the SQLDatabaseAct
• get a value from my workflow instance
• Activity custom drawing does not work
• Consuming custom activities at runtime u
• Error : ExpenseReporting - 2006-03
• Workflow aborted with SqlWorkflowPersist

Hot Articles

• TransactionService sample problem
• [invokeWorkflowActivity] How to get the
• FYI: Google CodeSearch for WF Samples
• Migrating to Beta 2.0
• If/Else - Code Condition using an Activi
• How can I Persistence a workflow Instanc
• Problem displaying state machine wf in t
• Problems with Tutorial Lab03/Ex02/Task02
• Problem compiling sample 'Foreach' activ
• Problem in WorkflowRuntime.WorkflowCompl
• WF Beta 2 and February WinFX CTP Compati
• Custom activity for showing windows forms
• Expense Example - Missing SQL Scripts?
• access controls in infopath form program
• Persistence service

Recommend Articles

• Declarative Workflows
• Deriving, CodeConditions and HandleExter
• EventHandlingScope
• Microsoft.SharePoint.Workflow
• Migrating to Beta 2.0
• Problem with Lab11 Exercise 2
• debugging problem
• Workflow + Offline + SmartClient
• Why use WWF?
• HELP!! SQL Persisence not working
• State workflow bug
• EventTypeId field in TrackingDataItem ta
• Scheduling workflow
• Adding a Task to Outlook from a work flow
• Painting activity with WPF?