public ToolDescriptorViewModel(IToolDescriptor tool, bool isEnabled) { VerifyArgument.AreNotNull(new Dictionary <string, object> { { "tool", tool } }); IsEnabled = isEnabled; UpdateToolActualType(tool); Tool = tool; }
void UpdateToolActualType(IToolDescriptor tool) { var type = typeof(DsfNativeActivity <>); var assembly = type.Assembly; { foreach (var exportedType in assembly.GetTypes()) { if (exportedType.FullName == tool.Activity?.FullyQualifiedName) { if (exportedType.AssemblyQualifiedName != null) { UpdateToolActualType(exportedType); } return; } } } }
private void UpdateToolActualType(IToolDescriptor tool) { var type = typeof(DsfNativeActivity <>); var assembly = type.Assembly; { foreach (var exportedType in assembly.GetTypes()) { if (exportedType.FullName == tool.Activity?.FullyQualifiedName) { if (exportedType.AssemblyQualifiedName != null) { if (exportedType.FullName != null && exportedType.FullName.Contains("DsfFlowDecisionActivity")) { var decisionType = typeof(FlowDecision); if (decisionType.AssemblyQualifiedName != null) { _activityType = new DataObject(DragDropHelper.WorkflowItemTypeNameFormat, decisionType.AssemblyQualifiedName); } } else if (exportedType.FullName != null && exportedType.FullName.Contains("DsfFlowSwitchActivity")) { var switchType = typeof(FlowSwitch <string>); if (switchType.AssemblyQualifiedName != null) { _activityType = new DataObject(DragDropHelper.WorkflowItemTypeNameFormat, switchType.AssemblyQualifiedName); } } else { _activityType = new DataObject(DragDropHelper.WorkflowItemTypeNameFormat, exportedType.AssemblyQualifiedName); } } return; } } } }