public List <ComponentNode> GetComponents() { List <ComponentNode> comps = new List <ComponentNode>(); if (_designerItems == null) { if (string.IsNullOrEmpty(WorkflowFile)) { //MessageBox.Show("Please select a work flow"); return(new List <ComponentNode>()); } else { comps = XmlSerialization.OpenWorkflowFile(WorkflowFile, ProcessRunTimeLocator.GetAppExtraDataTypes()); } } else { foreach (var item in _designerItems) { comps.Add(item.ThisComponent); } } return(comps); }
private static ComponentNode ExcuteComplexComponentNode(List <ComponentNode> paramList, ComponentNode thisNode, INotificationCallback callback, ProcessBatch batch, ProcessGroup group, ProcessJob job) { ComponentNode nextNode = null; if (thisNode.CompNodeValidation == NodeValidationType.Group) { return(thisNode); } Debug.WriteLine(thisNode.ComponentName); thisNode.ProcessedParentCount++; if (thisNode.ProcessedParentCount != thisNode.ParentIdList.Count) { // _excutableInWait.Add(thisNode); return(null); } Guid zero = new Guid(); var childrenParams = (from p in paramList where (p.ParentIdList.FirstOrDefault(pl => pl == thisNode.Id) != zero) select p).ToList(); // IEnumerable<ComponentNode> childrenParams = from p in paramList where p.ParentId == thisNode.Id select p; //IExcuteComponent component = ProcessObjectLocator.LocateComponentProcess(thisNode.CompopnentExcutionName); Type tp = ProcessRunTimeLocator.GetExecutableType(thisNode.CompopnentExcutionName); if (tp == null) { return(null); } IExcuteComponent component = (IExcuteComponent)Activator.CreateInstance(tp); if (component != null) { IResultForNextNode ret = component.ExcuteThermoComponent(paramList, thisNode, callback, batch, group, job); if (ret != null) { ret.ThisNodeId = thisNode.Id; foreach (var param in childrenParams) { param.ParentComponentResults.Add(ret); } } } thisNode.ParentComponentResults.Clear(); //_excutableInWait.Remove(thisNode); thisNode.ProcessedParentCount = 0; foreach (var childrenParam in childrenParams) { nextNode = ExcuteComplexComponentNode(paramList, childrenParam, callback, batch, group, job); } return(nextNode); }
private void DoProcess(object state) { Thread.Sleep(100); AsyncGroupResult result = (AsyncGroupResult)state; if (result.GroupNode != null) { if (result.GroupNode.CompNodeValidation == NodeValidationType.Group) { result.NextNode = result.GroupNode.FindChild(result.ComponentList) ?? null; } else { result.NextNode = result.GroupNode;//user may not select a group param, next is the batch param } } try { if (result.GroupNode != null) { //IExecuteGroupComponent component = // ProcessObjectLocator.LocateGroupComponentProcess(result.GroupNode.CompopnentExcutionName); Type tp = ProcessRunTimeLocator.GetExecutableGroupType(result.GroupNode.CompopnentExcutionName); if (tp == null) { return; } IExecuteGroupComponent component = (IExecuteGroupComponent)Activator.CreateInstance(tp); if (component != null) { var nextNodeResult = component.ExecuteComponent(result.Batch, result.Group, result.Batch.ExtraInfo, result.ComponentList, result.GroupNode, result.GroupCallback); if (result.NextNode != null) { result.NextNode.ParentComponentResults.Add(nextNodeResult); } //clear this group parent results result.GroupNode.ParentComponentResults.Clear(); } } } catch (Exception ex) { result.Exception = ex; throw; } finally { OnCompleted(result); } }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); ProcessRunTimeLocator.RegisterMnemeComponent(); Window1 mainWindow = new Window1(); mainWindow.Show(); Debug.WriteLine(""); }
protected void InjectThisComponent(string tag) { Type tp = ProcessRunTimeLocator.GetComponentNodeType(tag); if (tp == null) { return; } ThisComponent = (ComponentNode)Activator.CreateInstance(tp); //ThisComponent = (ComponentNode)ProcessRunTimeLocator.GetComponentNodeType(tag); //ProcessObjectLocator.LocateComponentPama(tag); }
private void DoProcess(object state) { Thread.Sleep(100); AsyncBatchResult result = (AsyncBatchResult)state; if (result.BatchNode != null) { if (result.BatchNode.CompNodeValidation == NodeValidationType.Batch) { result.NextNode = result.BatchNode.FindChild(result.ComponentList) ?? null; } else { result.NextNode = result.BatchNode;//user may not select a batch node, then next must be start node } } try { if (result.BatchNode != null) { //IExecuteBatchComponent component = ProcessObjectLocator.LocateBatchComponentProcess(result.BatchNode.CompopnentExcutionName); Type tp = ProcessRunTimeLocator.GetExecutableBatchType(result.BatchNode.CompopnentExcutionName); if (tp == null) { return; } IExecuteBatchComponent component = (IExecuteBatchComponent)Activator.CreateInstance(tp); if (component != null) { var nextNodeResult = component.ExecuteComponent(result.Batch, result.Batch.ExtraInfo, result.ComponentList, result.BatchNode, result.BatchCallback); if (result.NextNode != null) { result.NextNode.ParentComponentResults.Add(nextNodeResult); } } } } catch (Exception ex) { result.Exception = ex; throw; } finally { OnCompleted(result); } }
protected override void Execute(CodeActivityContext context) { List <ComponentNode> nodes = ComponentParameters.Get(context); var start = nodes[0].FindStartupNode(nodes); //IInitializeBatch batchInitializer = ProcessObjectLocator.LocateBatchInitializeProcess(start.BatchInitializeExcutionName); Type tp = ProcessRunTimeLocator.GetBatchInitializerType(start.BatchInitializeExcutionName); if (tp == null) { return; } IInitializeBatch batchInitializer = (IInitializeBatch)Activator.CreateInstance(tp); batchInitializer.ExecuteBatchInitializer(Batch.Get(context), nodes); }
private static IEnumerable <ComponentNode> ExcuteComplexStartNode(List <ComponentNode> paramList, ComponentNode startNode, ICollection <ExtraProcessInfo> extraProcessInfos, INotificationCallback callback, ProcessBatch batch, ProcessGroup group, ProcessJob job) { Guid zero = new Guid(); IEnumerable <ComponentNode> childParams = from p in paramList where (p.ParentIdList.FirstOrDefault(pl => pl == startNode.Id) != zero) select p; //IExecuteStartupComponent component = ProcessObjectLocator.LocateStartComponentProcess(startNode.CompopnentExcutionName); //if this work no requirement for registering with unity container Type tp = ProcessRunTimeLocator.GetExecutaleStartupType(startNode.CompopnentExcutionName); if (tp == null) { return(new ArraySegment <ComponentNode>()); } IExecuteStartupComponent component = (IExecuteStartupComponent)Activator.CreateInstance(tp); if (component != null) { //do waht ever client initiation here IResultForNextNode obj = component.ExecuteStartupComponent(batch, group, job, extraProcessInfos, paramList, startNode, callback); //since startup node takes raw file usually open it foreach (var param in paramList) { //set iRaw Data to each ComponentParameters param.StartupResult = obj; param.TreeExecutionTag = startNode.TreeExecutionTag; param.ParentComponentResults = new List <IResultForNextNode>(); param.ParentComponentResults.Add(obj); param.ProcessedParentCount = 0; } } return(childParams); }
private void ServerInitiate() { ProcessRunTimeLocator.RegisterMnemeComponent(); }