public void AddChildren(ActivityWrapper child) { lock (this) { if (Children.Contains(child) != false) { return; } lock (this) { if (Children.Contains(child) == false) { // avoid duplicacy Children.Add(child); } } } }
private void DocumentActivity(DocX body, ActivityWrapper childActivity) { body.DocumentLeafActivity(childActivity.Name); body.DocumentDescription(childActivity.GetDescription()); body.DocumentPlaceholders("Placeholder for Workflow Snapshot"); body.DocumentDependencies(childActivity.GetDependentList().ToCsv()); body.DocumentPlaceholders("Placeholder for Code/UI Snapshot"); body.DocumentDescription(childActivity.GetActivitySpecificDetails(_rulesExtractor.RuleDefinitions)); }
/* private static string FormatUserData(System.Collections.IDictionary iDictionary) { var builder = new StringBuilder(); foreach (var key in iDictionary.Keys) { builder.AppendFormat("Key: {0} Value: {1}", key, iDictionary[key] ?? "-").AppendLine(); } return builder.ToString(); } */ private static string Translate(ActivityWrapper activityWrapper, string inputFromTemplate) { var regEx = new Regex("[$](?<props>[a-zA-Z0-9]*)"); MatchCollection matchCollection = regEx.Matches(inputFromTemplate); string output = inputFromTemplate; for (int matchCounter = 0; matchCounter < matchCollection.Count; matchCounter++) { Match match = matchCollection[matchCounter]; if (match.Success) // has some keywords { Group group = match.Groups["props"]; CaptureCollection captures = group.Captures; for (int i = 0; i < captures.Count; i++) { string key = captures[i].Value; switch (key) { case "name": output = output.Replace("$name", activityWrapper.Name); break; case "dependents": output = output.Replace("$dependents", activityWrapper.GetDependentList().ToCsv()); break; default: try { var value = activityWrapper.Current.GetPublicPropertValue<string>(key); output = output.Replace("$" + key, key + ":" + value); } catch { try { var value = activityWrapper.GetPublicPropertValue<string>(key); output = output.Replace("$" + key, key + ":" + value); } catch { output = output.Replace("$" + key, key + ":" + "TBD"); } } break; } } } } return output; }
public void AddChildren(ActivityWrapper child) { lock (this) { if (Children.Contains(child) != false) return; lock (this) { if (Children.Contains(child) == false) { // avoid duplicacy Children.Add(child); } } } }