Thursday, April 30, 2009
Henrik Nilsson's RegexReplaceActiviy
While you're developing and tuning your regular expressions, it's handy to have a quick way to test them. I'd like to point you to a phenomenal online resource for testing regex patterns:
http://gskinner.com/RegExr/
If you paste Henrik's sample regex pattern into the site, and then type a date into the text box, it'll highlight the pattern that's matched. Then, if you hold your mouse over the highlighted pattern, it'll show you the groups that are captured. Instant gratification!
Tuesday, April 28, 2009
How to use EnumerateResourcesActivity in RC0
Per Henrik's advice, EnumerateResources has the wrong designer, so when you add the activity to a custom workflow, you'll notice that it's closed and you can't add any children to it.
You can work around this by opening the Designer.cs file and adding a code activity to it manually. First, add a CodeActivity to the class:
private CodeActivity codeActivity1;
Next, add the code activity to EnumerateResources in InitializeComponent, before the last line, "this.CanModifyActivities = false;".
#region Workaround
this.codeActivity1 = new System.Workflow.Activities.CodeActivity();
//
// codeActivity1
//
this.codeActivity1.Name = "codeActivity1";
this.codeActivity1.ExecuteCode += new System.EventHandler(this.logIteration);
this.enumerateResourcesActivity1.Activities.Add(this.codeActivity1);
#endregion
Then, create a "logIteration" method in your main class file, and call the GetCurrentIterationItem method from EnumerateResources:
private void logIteration(object sender, EventArgs e)
{
// Log the Resource properties to a string
StringBuilder buffer = new StringBuilder();
buffer.AppendLine("TotalResultsCount : " +
enumerateResourcesActivity1.TotalResultsCount);
ResourceType currentItem = EnumerateResourcesActivity.GetCurrentIterationItem(
(CodeActivity)sender) as ResourceType;
if (currentItem != null)
{
// Resource properties
foreach (KeyValuePair<string, ResourcePropertyInfo> property in currentItem.ResourceProperties)
{
// Attribute name
buffer.Append(property.Key.PadRight(20));
// Attribute type
buffer.Append(property.Value.Type.PadRight(20));
// Value
object val = currentItem[property.Key];
if (val != null)
{
buffer.AppendLine(val.ToString());
}
else
{
buffer.AppendLine();
}
}
}
// Finally, do something with the log message
string output = buffer.ToString();
}
That's it. Don't forget to bind the XPathFilter property on the EnumerateResourcesActivity. Perhaps I'll add an example to our activity library.
Enjoy!
Friday, April 17, 2009
ILM 2 password client install snafu
Office integration requires Smart Tags .Net Programmability Support. Please install it from the Office CDs (under Office Tools) and try again.
It turns out that, in my haste, I had selected all the defaults of the installation, which is an honest mistake. Since I was installing this on the dev server box for testing, I didn't have Office installed, yet I left the Office Integration component selected for install. The simple answer is to deselect this option during install.
Hope this helps!
ILM2/FIM Custom Workflow Development Webinar
| | ||
| |||
|
Source code posted
ILM 2 RC0 Ensynch Custom Workflow Activity Library
And a few screen shots for you...
Sorry for the lack of description on these, but I'll be hosting a webinar on them next week. More details on that coming soon...