Beispiel #1
0
        private void OnAddActionCommand(object obj)
        {
            var container = obj as ActionContainer;

            switch ((Types.ActionType)ComBoxSelectedAction.ID)
            {
            //特殊action 单独处理
            case Types.ActionType.IF:
                int id      = container.GetCreateActionID();
                var ifmodel = ActionData.GetCreateActionItemModel((Types.ActionType)ComBoxSelectedAction.ID);
                ifmodel.ID = id;
                container.AddItem(ifmodel);

                var elsemodel = ActionData.GetCreateActionItemModel(Types.ActionType.IFElse);
                elsemodel.ID       = container.GetCreateActionID();
                elsemodel.ParentID = id;
                container.AddItem(elsemodel);

                var endmodel = ActionData.GetCreateActionItemModel(Types.ActionType.IFEnd);
                endmodel.ID       = container.GetCreateActionID();
                endmodel.ParentID = id;
                container.AddItem(endmodel);
                break;

            default:
                //非特殊action
                var model = ActionData.GetCreateActionItemModel((Types.ActionType)ComBoxSelectedAction.ID);
                model.ID = container.GetCreateActionID();
                container.AddItem(model);
                break;
            }

            OnActionDialogStateCommand(false);
        }
Beispiel #2
0
        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);
        }
 public ShutdownActionBuilder()
 {
     actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Shutdown);
     action           = new Core.Action.Models.ActionModel();
     action.Action    = Core.Action.Types.ActionType.Shutdown;
     actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.Shutdown);
 }
        public KillProcessActionBuilder()
        {
            actionItem        = ActionData.GetCreateActionItemModel(UI.Types.ActionType.KillProcess);
            action            = new Core.Action.Models.ActionModel();
            action.Action     = Core.Action.Types.ActionType.KillProcess;
            inputData         = new KillProcessActionInputModel();
            inputModels       = new List <ActionInputModel>();
            detailInputModels = new List <ActionInputModel>();

            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.KillProcess);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "区分大小写,不需要填写.exe",
                Title       = "进程名称",
                IsStretch   = true,
                BindingName = nameof(KillProcessActionInputModel.ProcessName)
            });

            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Bool,
                Title       = "模糊匹配",
                BindingName = nameof(KillProcessActionInputModel.IsFuzzy)
            });
        }
        public RegexActionBuilder()
        {
            actionItem        = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Regex);
            action            = new Core.Action.Models.ActionModel();
            action.Action     = Core.Action.Types.ActionType.Regex;
            inputData         = new RegexActionInputModel();
            inputModels       = new List <ActionInputModel>();
            detailInputModels = new List <ActionInputModel>();

            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.Regex);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入",
                Title       = "内容",
                BindingName = nameof(RegexActionInputModel.Content)
            });
            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入",
                Title       = "正则表达式",
                BindingName = nameof(RegexActionInputModel.Regex)
            });
        }
        public IFActionActionBuilder()
        {
            actionItem    = ActionData.GetCreateActionItemModel(UI.Types.ActionType.IF);
            action        = new Core.Action.Models.ActionModel();
            action.Action = Core.Action.Types.ActionType.IF;
            inputData     = new IFActionInputModel()
            {
                Condition = IFActionConditionData.ComBoxData[0]
            };
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.IF);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Title       = "如果",
                Placeholder = "请输入",
                BindingName = nameof(IFActionInputModel.Left)
            });
            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Select,
                SelectItems = IFActionConditionData.ComBoxData,
                BindingName = nameof(IFActionInputModel.Condition)
            });
            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入",
                BindingName = nameof(IFActionInputModel.Right)
            });
        }
Beispiel #7
0
        public DownloadFileActionBuilder()
        {
            actionItem        = ActionData.GetCreateActionItemModel(UI.Types.ActionType.DownloadFile);
            action            = new Core.Action.Models.ActionModel();
            action.Action     = Core.Action.Types.ActionType.DownloadFile;
            inputData         = new DownloadFileActionInputModel();
            inputModels       = new List <ActionInputModel>();
            detailInputModels = new List <ActionInputModel>();
            actionResultKeys  = ActionData.GetActionResults(UI.Types.ActionType.DownloadFile);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入网络文件链接",
                Title       = "网络文件链接",
                BindingName = nameof(DownloadFileActionInputModel.Url)
            });
            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入保存路径,包括文件名",
                Title       = "保存路径",
                BindingName = nameof(DownloadFileActionInputModel.SavePath)
            });

            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.CustomKeyValue,
                Title       = "请求头",
                BindingName = nameof(DownloadFileActionInputModel.Headers)
            });
        }
Beispiel #8
0
        public SystemNotificationActionBuilder()
        {
            actionItem    = ActionData.GetCreateActionItemModel(UI.Types.ActionType.SystemNotification);
            action        = new Core.Action.Models.ActionModel();
            action.Action = Core.Action.Types.ActionType.SystemNotification;
            inputData     = new SystemNotificationActionInputModel()
            {
                ToastScenarioType = SystemNotificationActionData.ToastScenarioTypes[0],
                ToastActionType   = SystemNotificationActionData.ToastActionTypes[0]
            };
            inputModels       = new List <ActionInputModel>();
            detailInputModels = new List <ActionInputModel>();

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入",
                Title       = "标题",
                //IsStretch = true,
                BindingName = nameof(SystemNotificationActionInputModel.Title)
            });
            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.MultiLineText,
                Placeholder = "请输入",
                Title       = "内容",
                //IsStretch = true,
                BindingName = nameof(SystemNotificationActionInputModel.Content)
            });

            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Select,
                Title       = "通知类型",
                SelectItems = SystemNotificationActionData.ToastScenarioTypes,
                BindingName = nameof(SystemNotificationActionInputModel.ToastScenarioType)
            });
            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Title       = "图标",
                Placeholder = "支持网络图片和本地图片",
                BindingName = nameof(SystemNotificationActionInputModel.Icon)
            });
            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Select,
                Title       = "点击通知操作",
                SelectItems = SystemNotificationActionData.ToastActionTypes,
                BindingName = nameof(SystemNotificationActionInputModel.ToastActionType)
            });
            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入链接,仅在通知操作为打开链接时有效",
                Title       = "打开链接",
                //IsStretch = true,
                BindingName = nameof(SystemNotificationActionInputModel.Url)
            });
        }
Beispiel #9
0
        public HttpRequestActionBuilder()
        {
            actionItem    = ActionData.GetCreateActionItemModel(UI.Types.ActionType.HttpRequest);
            action        = new Core.Action.Models.ActionModel();
            action.Action = Core.Action.Types.ActionType.HttpRequest;
            inputData     = new HttpRequestActionInputModel()
            {
                PamramsType = HttpRequestActionData.PamramsTypes[0],
                Method      = HttpRequestActionData.MethodTypes[0]
            };
            inputModels       = new List <ActionInputModel>();
            detailInputModels = new List <ActionInputModel>();
            actionResultKeys  = ActionData.GetActionResults(UI.Types.ActionType.HttpRequest);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Title       = "请求地址",
                Placeholder = "请输入完整地址",
                IsStretch   = true,
                BindingName = nameof(HttpRequestActionInputModel.Url)
            });

            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Select,
                Title       = "方法",
                SelectItems = HttpRequestActionData.MethodTypes,
                BindingName = nameof(HttpRequestActionInputModel.Method)
            });
            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Select,
                Title       = "参数类型",
                SelectItems = HttpRequestActionData.PamramsTypes,
                BindingName = nameof(HttpRequestActionInputModel.PamramsType)
            });

            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.CustomKeyValue,
                Title       = "请求参数",
                BindingName = nameof(HttpRequestActionInputModel.QueryParams)
            });
            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.CustomKeyValue,
                Title       = "请求头",
                BindingName = nameof(HttpRequestActionInputModel.Headers)
            });
            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.CustomKeyValue,
                Title       = "文件(仅Form参数类型时有效)",
                BindingName = nameof(HttpRequestActionInputModel.Files)
            });
        }
Beispiel #10
0
        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);
        }
Beispiel #11
0
        public SnippingActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Snipping);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.Snipping;
            inputData        = new SnippingActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.Snipping);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入保存路径",
                Title       = "截图保存路径",
                IsStretch   = true,
                BindingName = nameof(SnippingActionInputModel.SavePath)
            });
        }
        public SoundPlayActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.SoundPlay);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.SoundPlay;
            inputData        = new SoundPlayActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.SoundPlay);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入音频文件路径,支持mp3、wav",
                Title       = "音频文件路径",
                IsStretch   = true,
                BindingName = nameof(SoundPlayActionInputModel.Path)
            });
        }
Beispiel #13
0
        public ReadFileActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.ReadFile);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.ReadFile;
            inputData        = new ReadFileActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.ReadFile);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入本地文件路径",
                Title       = "文件路径",
                IsStretch   = true,
                BindingName = nameof(ReadFileActionInputModel.FilePath)
            });
        }
Beispiel #14
0
        public OpenURLActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.OpenURL);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.OpenURL;
            inputData        = new OpenURLActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.OpenURL);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入网页链接",
                Title       = "链接",
                IsStretch   = true,
                BindingName = nameof(OpenURLActionInputModel.URL)
            });
        }
        public KeyboardActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Keyboard);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.Keyboard;
            inputData        = new KeyboardActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.Keyboard);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入按键名,支持组合键如:Ctrl+G",
                Title       = "按键",
                IsStretch   = true,
                BindingName = nameof(KeyboardActionInputModel.Keys)
            });
        }
Beispiel #16
0
        public JsonDeserializeActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.JsonDeserialize);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.JsonDeserialize;
            inputData        = new JsonDeserializeActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.JsonDeserialize);


            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "需要解析的json",
                Title       = "Json",
                IsStretch   = true,
                BindingName = nameof(JsonDeserializeActionInputModel.Content)
            });
        }
        public LoopsActionBuilder()
        {
            actionItem    = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Loops);
            action        = new Core.Action.Models.ActionModel();
            action.Action = Core.Action.Types.ActionType.Loops;
            inputData     = new LoopsActionInputModel()
            {
                Count = 1
            };
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.Loops);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Number,
                Title       = "次数",
                Placeholder = "请输入循环次数",
                BindingName = nameof(LoopsActionInputModel.Count)
            });
        }
Beispiel #18
0
        public DelayActionBuilder()
        {
            actionItem    = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Delay);
            action        = new Core.Action.Models.ActionModel();
            action.Action = Core.Action.Types.ActionType.Delay;
            inputData     = new DelayActionInputModel()
            {
                Seconds = "3"
            };
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.Delay);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Number,
                Placeholder = "秒",
                Title       = "延迟(秒)",
                IsStretch   = true,
                BindingName = nameof(DelayActionInputModel.Seconds)
            });
        }
Beispiel #19
0
        public SetDeviceVolumeActionBuilder()
        {
            actionItem    = ActionData.GetCreateActionItemModel(UI.Types.ActionType.SetDeviceVolume);
            action        = new Core.Action.Models.ActionModel();
            action.Action = Core.Action.Types.ActionType.SetDeviceVolume;
            inputData     = new SetDeviceVolumeActionInputModel()
            {
                Volume = "50"
            };
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.SetDeviceVolume);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "音量值 0-100",
                Title       = "音量",
                IsStretch   = true,
                BindingName = nameof(SetDeviceVolumeActionInputModel.Volume)
            });
        }
        public DialogActionBuilder()
        {
            actionItem        = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Dialog);
            action            = new Core.Action.Models.ActionModel();
            action.Action     = Core.Action.Types.ActionType.Dialog;
            inputData         = new DialogActionInputModel();
            inputModels       = new List <ActionInputModel>();
            detailInputModels = new List <ActionInputModel>();
            actionResultKeys  = ActionData.GetActionResults(UI.Types.ActionType.Dialog);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Title       = "标题",
                Placeholder = "请输入",
                BindingName = nameof(DialogActionInputModel.Title)
            });

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Title       = "内容",
                Placeholder = "请输入",
                BindingName = nameof(DialogActionInputModel.Content)
            });
            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Title       = "图标",
                Placeholder = "请输入图标文件路径,仅支持本地图片",
                BindingName = nameof(DialogActionInputModel.Image)
            });

            detailInputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.CustomKeyValue,
                Title       = "按钮",
                BindingName = nameof(DialogActionInputModel.Buttons)
            });
        }
Beispiel #21
0
        public GetIPAddressActionBuilder()
        {
            actionItem    = ActionData.GetCreateActionItemModel(UI.Types.ActionType.GetIPAddress);
            action        = new Core.Action.Models.ActionModel();
            action.Action = Core.Action.Types.ActionType.GetIPAddress;
            inputData     = new GetIPAddressActionInputModel()
            {
                //选择下拉框的需要指定默认选择
                Type = GetIPAddressActionData.IPAddressTypes[0]
            };
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.GetIPAddress);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Select,
                Title       = "获取类型",
                IsStretch   = true,
                SelectItems = GetIPAddressActionData.IPAddressTypes,
                BindingName = nameof(GetIPAddressActionInputModel.Type)
            });
        }
Beispiel #22
0
        public WriteFileActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.WriteFile);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.WriteFile;
            inputData        = new WriteFileActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.WriteFile);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入文件路径",
                Title       = "路径",
                BindingName = nameof(WriteFileActionInputModel.FilePath)
            });
            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入文件内容",
                Title       = "内容",
                BindingName = nameof(WriteFileActionInputModel.Content)
            });
        }
 public StartProcessActionBuilder()
 {
     actionItem        = ActionData.GetCreateActionItemModel(UI.Types.ActionType.StartProcess);
     action            = new Core.Action.Models.ActionModel();
     action.Action     = Core.Action.Types.ActionType.StartProcess;
     inputData         = new StartProcessActionInputModel();
     inputModels       = new List <ActionInputModel>();
     actionResultKeys  = ActionData.GetActionResults(UI.Types.ActionType.StartProcess);
     detailInputModels = new List <ActionInputModel>();
     inputModels.Add(new ActionInputModel()
     {
         InputType   = Types.InputType.Text,
         Title       = "进程路径",
         Placeholder = "请输入进程路径",
         IsStretch   = true,
         BindingName = nameof(StartProcessActionInputModel.Path)
     });
     detailInputModels.Add(new ActionInputModel()
     {
         InputType   = Types.InputType.Text,
         Title       = "启动参数",
         BindingName = nameof(StartProcessActionInputModel.Args)
     });
 }