Kola

Hi,

i'm using the Re-hosting Workflow designer example and making my own adjustments to it. When I run the example I am not able to set the Invoke method of my codebehind (.xoml.cs) for an HandleExternalEventActivity thru the designer...I can only make the .xoml file and MyWorkflow.dll available to the Designer Rehosting example.

Do I need to provide my codebehind (.xoml.cs) to the Designer example

How to set HandleExternalEventActivity invoke method

If i modify WorkflowDesignerControl.cs --> CompileWorkflow method as follows:

string codeBesideFile = Path.Combine(Path.GetDirectoryName(this.loader.Xoml), Path.GetFileNameWithoutExtension(this.loader.Xoml) + ".cs");

TO

string codeBesideFile = Path.Combine(Path.GetDirectoryName(this.loader.Xoml), Path.GetFileNameWithoutExtension(this.loader.Xoml) + ".xoml.cs");

In my xoml.cs i have code as follows:

using Sample.Information.Entities;

using Sample.Information.Utilties;

I have reffered the Sample.Information.Entities.dll and Sample.Information.Utilties.dll like MyWorkflow.dll, however when i compile the Workflow getting the following error:

"error CS0234: The type or namespace name 'Entities' does not exists in the namespace 'Sample.Information'(are you missing an assembly reference )

error CS0234: The type or namespace name 'Utilties' does not exists in the namespace 'Sample.Information'(are you missing an assembly reference )

Is there anything I am missing

Thanks in Advance,
Kola



Re: Windows Workflow Foundation HandleExternalEventActivity + Invoke Method + Workflow Designer Re-hosting example

Tom Lake - MSFT

Are you saying that you created .xoml and associated .xoml.cs files outside the re-hosted workflow designer and when you load the files into the re-hosted designer the code within the .xoml.cs file is not available to you If so, this is because you would need to implement a C# parser for this to work. Take a look at the post at http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=976529&SiteID=1 for more information. If not, can you please explain again






Re: Windows Workflow Foundation HandleExternalEventActivity + Invoke Method + Workflow Designer Re-hosting example

Kola

i checked http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=976529&SiteID=1, tried doing from this post getting an error as follows when i compile MyWorkflow.xoml;

At codeCompileUnit = csharpProvider.Parse(File.OpenText(codeFilePath));

Error Dialog As:

NotImplementedException was unhandled

This CodeDomProvider does not support this method.

I have StateMachine MyWorkflow.xoml file, contains HandleExternalEventActivity which is invoking a method (SetStatus_Invoke) from MyWorkflow.xoml.cs. I opened MyWorkflow.xoml using Designer Rehosting example and compile the workflow then I am getting an error as follows:

'...\MyWorkflow.xoml' :error CS0117: MyWorkflow does not contain a definition for 'SetStatus_Invoke'

i have found that designer is creating MyWorkflow.cs and it is checking into that class file while compiling, That's the reason i Modified WorkflowDesignerControl.cs-->CompileWorkflow Method as follows

string codeBesideFile = Path.Combine(Path.GetDirectoryName(this.loader.Xoml), Path.GetFileNameWithoutExtension(this.loader.Xoml) + ".cs");

TO

string codeBesideFile = Path.Combine(Path.GetDirectoryName(this.loader.Xoml), Path.GetFileNameWithoutExtension(this.loader.Xoml) + ".xoml.cs");

Now when i compile MyWorkflow.xoml from Designer Rehosting getting an error as follows, because of the two include namespaces i m using in MyWorkflow.xoml.cs

using Sample.Information.Entities;

using Sample.Information.Utilties;

"error CS0234: The type or namespace name 'Entities' does not exists in the namespace 'Sample.Information'(are you missing an assembly reference )

error CS0234: The type or namespace name 'Utilties' does not exists in the namespace 'Sample.Information'(are you missing an assembly reference )

Some times i should be able to change HandleExternalEventActivity invoke method using Designer Rehosting...

how to make available of MyWorkflow.xoml.cs to the designer

Thanks,

Kola





Re: Windows Workflow Foundation HandleExternalEventActivity + Invoke Method + Workflow Designer Re-hosting example

Tom Lake - MSFT

The point of that post was what you have found, the CSharpProvider has not implemented the parser I was not intending for you to try the code. When you open a xoml file and its associated .cs file the code file will be cleared as you have found. The reason is because there is no C# parser. With the re-hosted designer you can create new code handlers but you would need to come up with you own method of adding code to the added handlers.






Re: Windows Workflow Foundation HandleExternalEventActivity + Invoke Method + Workflow Designer Re-hosting example

Kola

OK...can you please help me orelse suggest me some posts/links...How to create new code handlers and adding code to the handlers...

Anybody please help me on this...I was finally got blocked here to compile my workflow using designer rehosting...

Thanks In Advance,

Kola





Re: Windows Workflow Foundation HandleExternalEventActivity + Invoke Method + Workflow Designer Re-hosting example

Kola

Hey I tried to implement pure xoml....Deleted the .xoml.cs

code in .xoml file as follows:

<x:Code><![CDATA[

private void ActivityName(object sender, EventArgs e)
{

.......
}
public static DependencyProperty CREventArgsProperty = DependencyProperty.Register("CREventArgs", typeof(WorkFlow.Interfaces.CREventArgs), typeof(MyWorkflow)); [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)] [BrowsableAttribute(true)] [CategoryAttribute("Parameters")]
public WorkFlow.Interfaces.AISEventArgs CREventArgs
{
get
{

return ((WorkFlow.Interfaces.CREventArgs)(base.GetValue(MyWorkflow.CREventArgsProperty)));
}
set
{ base.SetValue(MyWorkflow.CREventArgsProperty, value);
}
}
]]></x:Code>

Problem is..... Designer (Designer Rehosting Sample) is not parsing this code ....when I am trying to bind the method from Designer to the workflow it is showing in properties...I have to set the Dependency Property from Designer Rehosting...Is there any other alternative to set the MyWorkflow.xoml dependency property from designer rehosting...

or else is there a way to parse the code in xoml file

---

Kola





Re: Windows Workflow Foundation HandleExternalEventActivity + Invoke Method + Workflow Designer Re-hosting example

Tom Lake - MSFT

Using CDATA is not officially supported however it only works when you are compiling the workflow into a type, so it won't work for XAML Activation. As for a C# parser there are not any posts that I can point you to and the forum is not the correct location to help you with creating one, it is not a trival thing to do. You might try one of the C# forums found at http://forums.microsoft.com/MSDN/default.aspx ForumGroupID=9&SiteID=1.






Re: Windows Workflow Foundation HandleExternalEventActivity + Invoke Method + Workflow Designer Re-hosting example

Kola

Hi Tom,

OK ...i removed that CDATA and tried to modify the constructor and Intitialize method of WorkflowLoader

in constructor i have modified CodeTypeDeclaration and added code for CodeMemberMethod, and in Initialize method added MyWorkflow to this.SetBaseComponentClassName like this.SetBaseComponentClassName("MyWorkflow ");

its working(compiling) fine if I load MyWorkflow.xoml thru Designer ReHosting sample.

However, I should be able to load and compile three more workflows like this...How can it would be possible How can i create instances for other 3 xoml.cs classes

Lets say I have Workflow2.xoml,Workflow3.xoml,Workflow4.xoml each have different codebehind files...is there any hard coding possible

Thanks,

Kola





Re: Windows Workflow Foundation HandleExternalEventActivity + Invoke Method + Workflow Designer Re-hosting example

Kola

Hi Tom,

After passing the xoml file path to the constructor of WorkflowLoader... i am able to create instance of any xoml.cs w.r.t the opening xoml file.

Now I am able to load and compile the multiple workflows with the designer rehosting sample.

Thanks,

Kola