コード例 #1
0
        public MouseActionItem(ActionItem action = null)
            : base(ActionType.Mouse)
        {
            Name = "鼠标动作";

            Copy(action);
        }
コード例 #2
0
        public KeyboardActionItem(ActionItem action = null)
            : base(ActionType.Keyboard)
        {
            Name = "键盘动作";

            Copy(action);
        }
コード例 #3
0
        private static ActionItem xelement2Action(XElement action, ActionType type)
        {
            var act = new ActionItem(type);

            XAttribute name = action.Attribute("Name");
            if (name != null)
            {
                act.Name = name.Value;
            }

            XAttribute repeat = action.Attribute("RepeatTime");
            if (repeat != null)
            {
                act.RepeatTime = str2Int(repeat.Value);
            }

            XAttribute interval = action.Attribute("Interval");
            if (interval != null)
            {
                act.Interval = str2Int(interval.Value);
            }

            XAttribute wait = action.Attribute("Wait");
            if (wait != null)
            {
                act.Wait = str2Int(wait.Value);
            }

            return act;
        }
コード例 #4
0
        private static XElement action2Element(ActionItem action)
        {
            var e = new XElement("Action");

            foreach (var i in action.GetType().GetProperties())
            {
                e.Add(new XAttribute(i.Name, i.GetValue(action, null) ?? ""));
            }

            return e;
        }
コード例 #5
0
        public void Copy(ActionItem action)
        {
            if (action == null) return;

            Name = action.Name;
            RepeatTime = action.RepeatTime;
            Interval = action.Interval;
            Wait = action.Wait;
        }