private void ImportGroupAction(Core.Action.Models.ActionModel action, int parentID = 0) { //创建头 var builder = ActionBuilder.BuilderByAction(action); var actionModel = builder.GetActionItemModel(); var a = action.Parameter as BaseGroupActionParamsModel; var parameter = ObjectConvert.Get <BaseGroupActionParamsModel>(action.Parameter); actionModel.ParentID = parentID; AddItem(actionModel, builder); //创建action子级 if (parameter.Actions.Count > 0) { foreach (var item in parameter.Actions) { ImportAction(item, actionModel.ID); } } //创建end action var endActionModel = ActionData.GetCreateActionItemModel(UI.Types.ActionType.LoopsEnd); endActionModel.ID = GetCreateActionID(); endActionModel.ParentID = actionModel.ID; AddItem(endActionModel); }
private void ImportIFAction(Core.Action.Models.ActionModel action) { if (action.Action != Core.Action.Types.ActionType.IF) { return; } //创建if action var builder = ActionBuilder.BuilderByAction(action); var ifActionModel = builder.GetActionItemModel(); var ifParameter = ObjectConvert.Get <IFActionParameterModel>(action.Parameter); //var ifParameter = ObjectConvert.Get<IFActionParameterModel>(action.Parameter); //var ifActionModel = ActionData.GetCreateActionItemModel(UI.Types.ActionType.IF); //ifActionModel.ID = action.ID; //var ifActionInputData = new IFActionInputModel(); //ifActionInputData.Left = ifParameter.LeftInput; //ifActionInputData.Right = ifParameter.RightInput; //ifActionInputData.Condition = IFActionConditionData.GetCombox((int)ifParameter.Condition); AddItem(ifActionModel, builder); //创建pass子级 if (ifParameter.PassActions.Count > 0) { foreach (var passaction in ifParameter.PassActions) { ImportAction(passaction, ifActionModel.ID); } } //创建else action var elseActionModel = ActionData.GetCreateActionItemModel(UI.Types.ActionType.IFElse); elseActionModel.ID = GetCreateActionID(); elseActionModel.ParentID = ifActionModel.ID; AddItem(elseActionModel); //创建unpass子级 if (ifParameter.NoPassActions.Count > 0) { foreach (var passaction in ifParameter.NoPassActions) { ImportAction(passaction, ifActionModel.ID); } } //创建end action var endActionModel = ActionData.GetCreateActionItemModel(UI.Types.ActionType.IFEnd); endActionModel.ID = GetCreateActionID(); endActionModel.ParentID = ifActionModel.ID; AddItem(endActionModel); }
private void ImportAction(Core.Action.Models.ActionModel action, int parentID = 0) { if (action.Action == Core.Action.Types.ActionType.IF) { ImportIFAction(action, parentID); return; } if (action.Action == Core.Action.Types.ActionType.Loops) { ImportGroupAction(action, parentID); return; } var builder = ActionBuilder.BuilderByAction(action); var actionItem = builder.GetActionItemModel(); actionItem.ParentID = parentID; if (builder != null) { AddItem(actionItem, builder); } }
private void ImportAction(Core.Action.Models.ActionModel action, int parentID = 0) { if (action.Action == Core.Action.Types.ActionType.IF) { ImportIFAction(action); return; } //switch (action.Action) //{ // case Core.Action.Types.ActionType.WriteFile: // actionModel = ActionData.GetCreateActionItemModel(UI.Types.ActionType.WriteFile); // var writefileParameter = ObjectConvert.Get<WriteFileActionParameterModel>(action.Parameter); // if (writefileParameter != null) // { // inputdata = new WriteFileActionInputModel() // { // FilePath = writefileParameter.FilePath, // Content = writefileParameter.Content // }; // } // break; // case Core.Action.Types.ActionType.HttpRequest: // actionModel = ActionData.GetCreateActionItemModel(UI.Types.ActionType.HttpRequest); // var httpRequestParameter = ObjectConvert.Get<HttpRequestActionParameterModel>(action.Parameter); // if (httpRequestParameter != null) // { // inputdata = new HttpRequestActionInputModel() // { // Url = httpRequestParameter.Url, // Method = HttpRequestActionData.GetMethodType((int)httpRequestParameter.Method), // PamramsType = HttpRequestActionData.GetPamramsType((int)httpRequestParameter.ParamsType), // QueryParams = httpRequestParameter.QueryParams, // Files = httpRequestParameter.Files, // Headers = httpRequestParameter.Headers // }; // } // break; // case Core.Action.Types.ActionType.Shutdown: // actionModel = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Shutdown); // break; // case Core.Action.Types.ActionType.StartProcess: // actionModel = ActionData.GetCreateActionItemModel(UI.Types.ActionType.StartProcess); // var spparams = ObjectConvert.Get<StartProcessActionParamsModel>(action.Parameter); // if (spparams != null) // { // inputdata = new StartProcessActionInputModel() // { // Path = spparams.Path, // Args = spparams.Args // }; // } // break; //} var builder = ActionBuilder.BuilderByAction(action); var actionItem = builder.GetActionItemModel(); actionItem.ParentID = parentID; if (builder != null) { AddItem(actionItem, builder); } }