/// <summary> /// Loads the dynamic activity from cache. /// </summary> /// <returns>The activity or null if WorkflowPath property does not have a value.</returns> private DynamicActivity LoadDynamicActivityFromCache() { if (this.WorkflowPath != null && !string.IsNullOrEmpty(this.WorkflowPath)) { if (!this.WorkflowPath.Contains(":")) { string fullname = SelectHelper.ProjectLocation + Path.DirectorySeparatorChar + this.WorkflowPath; if (File.Exists(fullname)) { return(DynamicActivityStore.GetActivity(fullname, reloadXaml)); } else { Logger.Log.Logger.LogData("Please enter valid file path in activity InvokeXamlWorkflow", Logger.LogLevel.Error); return(null); } } else { return(DynamicActivityStore.GetActivity(this.WorkflowPath, reloadXaml)); } } else { return(null); } }
/// <summary> /// Converts a string representing a file path to just the filename component of that string. Any environment variables within the string /// are first resolved. /// </summary> /// <param name="value">The value produced by the binding source.</param> /// <param name="targetType">The type of the binding target property.</param> /// <param name="parameter">The converter parameter to use.</param> /// <param name="culture">The culture to use in the converter.</param> /// <returns> /// A converted string. If the method returns null, the valid null value is used. /// </returns> public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string fullPath = value as string; if (!string.IsNullOrEmpty(fullPath)) { try { return(Path.GetFileName(DynamicActivityStore.ReplaceEnvironmentVariables(fullPath))); } catch { return(fullPath); } } return(Resources.UndefinedPathErrorText); }
/// <summary> /// Initialises the DynamicArgumentDialog instance with child workflow arguments by loading the specified child workflow then deriving its arguments. /// </summary> private void InitImportDynamicArgumentDialog() { workflowPath = this.ModelItem.Properties["WorkflowPath"].Value.GetCurrentValue() as string; if (!workflowPath.Contains(":")) { workflowPath = SelectHelper.ProjectLocation + Path.DirectorySeparatorChar + workflowPath; } if ((!string.IsNullOrEmpty(workflowPath)) && workflowPath.Trim().Length > 0) { Dictionary <string, Argument> oldargumentDictionary = new Dictionary <string, Argument>(); //akf oldargumentDictionary = argumentDictionary; argumentDictionary = new Dictionary <string, Argument>(); //this.currentlyLoadedWorkflowPath = workflowPath; try { DynamicActivity dynamicActivity = DynamicActivityStore.GetActivity(workflowPath, 1); //Designer mode if (dynamicActivity != null) { foreach (DynamicActivityProperty property in dynamicActivity.Properties) { Argument newArgument = null; if (property.Type.GetGenericTypeDefinition().BaseType == typeof(InArgument)) { newArgument = Argument.Create(property.Type.GetGenericArguments()[0], ArgumentDirection.In); } if (property.Type.GetGenericTypeDefinition().BaseType == typeof(OutArgument)) { newArgument = Argument.Create(property.Type.GetGenericArguments()[0], ArgumentDirection.Out); } if (property.Type.GetGenericTypeDefinition().BaseType == typeof(InOutArgument)) { newArgument = Argument.Create(property.Type.GetGenericArguments()[0], ArgumentDirection.InOut); } if (newArgument != null) { argumentDictionary.Add(property.Name, newArgument); } } //to retain already existing values of arguments if (oldargumentDictionary.Count != 0) { foreach (var oldkey in oldargumentDictionary.Keys) { foreach (var newkey in argumentDictionary.Keys) { if (oldkey.Equals(newkey)) { argumentDictionary[newkey] = oldargumentDictionary[oldkey]; break; } } } } } } catch { // ignore load failures - leave to handle in CacheMetadata } } }