I just tried something and it worked. Hopefully the same will work for you. I put a Default Server Event in the first Activity of a process. I went into the code and put the following method:
public static string Test(string input)
{
return input + "world";
}
The class name for this Server Event is EventItem_6312392b46a84bc4b5a23e1cffce1494. I then added another Server Event in another Activity and put the following code:
using(StreamWriter sw = new StreamWriter(@"C: empoutput.txt", false))
{
sw.Write(EventItem_6312392b46a84bc4b5a23e1cffce1494.Test("hello, "));
}
I ran the process and had a file called output.txt with hello, world in it. I would think that you should be able to go into any of your non-Default Server Event code files and use this approach.
One more note... The Server Event is going to place the .cs files in the CSCode-xxxx project. You should be able to use the same approach by adding the static method to your non-DefaultServerEvent events to the code-behind so it is referencable from the CSWinWF-xxxx project files.
Why don't you create a seperate project (assembly) that you references in both your K2 processes?
Cato,
A seperate assembly is my current solution but it seemed like overkill for just one simple method. I was hoping I was mising an easier way, to keep things as simple as possible. I'm afraid erice's solution, while technically sound is a bit too complicated (no offense, erice, I appreciate the idea).
Putting in a separate assembly is the recommended way to do it.