Skip to main content

Is there a way to get the view flow for a process as a static image? Currently I only know how to access the view flow by going through the workspace worklist and selecting "View Flow." Is there some way to request the data for the view flow from the server to be used in a customized UI or handed off to another application which would handle the drawing of a static image?

I'm sure I understand the question 100%, but I'm guessing that you don't really need the image, you just want to render Viewflow from a custom page.


If that's the case, you can reuse the page created in Workspace to do so, have a look at the following post:
http://www.k2underground.com/blogs/smoreclientcode/archive/2009/11/04/recipe-viewflow-url-for-your-process-instance.aspx


You can also embed the control in your page, but that requires you to use the API and you will need to pass the relevant XML along, kindof reinventing the wheel.


Unfortunately, no. I'd like this to run outside of an IE environment and be supported on as many platforms as possible. Reusing the control(s) used on the View Flow page somewhat hinders that. :(


This was actually possible in K2.net 2003. You can use the ViewProcessInstance.dll assembly in the "K2 View Flow" Folder. The full article explaining usage in a Windows app can be found here:
http://help.k2.com/en/KB000023.aspx


Just tested it briefly, still works in blackpearl. Sample project attached (Disclaimer: not best practices)


I'm a bit at a loss as to how to get this into a static image. I've been bashing my head against the wall for a couple of hours now trying to get it to work. I figured rendering the control then copying it to a bitmap would work but no dice so far. Here's what I've been trying:


            ViewProcessInstance.ViewControl oControl = new ViewProcessInstance.ViewControl();            

SCConnectionStringBuilder csBuilder = new SCConnectionStringBuilder();
csBuilder.Authenticate = true;
csBuilder.Integrated = true;
csBuilder.Host = "workspace";
csBuilder.Port = 5252;
csBuilder.IsPrimaryLogin = true;
csBuilder.SecurityLabelName = "K2";
csBuilder.WindowsDomain = "DOMAIN";
csBuilder.UserID = "USER";
csBuilder.Password = "PASSWORD";

ConnectionSetup connSetup = new ConnectionSetup();
connSetup.ConnectionString = csBuilder.ConnectionString;

Connection conn = new Connection();

conn.Open(connSetup);

string sXML = conn.ViewProcessInstance(11);

oControl.Xml = sXML;

oControl.DrawToBitmap(img, bounds);



Right now this doesn't work at all in ASP.NET and fails on oControl.DrawToBitmap, but in the WinForms code it seems to render a blank image. Not really sure where to go from here.


 


Well I got it working by adding it to a WinForm first, showing the form, rendering the form to the bitmap, then disposing of the form. Seems kinda hackish though.


Reply