示例#1
0
 //往列表里加入一个命令,如果有名字相同的则不再添加
 public static void addCommand(List<CommandMatch> list, CommandMatch cmd)
 {
     bool b = list.Exists((_cmd) =>
     {
         return _cmd.name == cmd.name;
     });
     if (!b)
     {
         list.Add(cmd);
     }
 }
示例#2
0
        //往列表里加入一个命令,如果有名字相同的则不再添加
        public static void addCommand(List <CommandMatch> list, CommandMatch cmd)
        {
            bool b = list.Exists((_cmd) =>
            {
                return(_cmd.name == cmd.name);
            });

            if (!b)
            {
                list.Add(cmd);
            }
        }
示例#3
0
        public static void matchCommand(CommandMatch _command)
        {
            if (null == _command)
            {
                return;
            }
            IDeviceCommand idc = DeviceCommandList.Find((_temp) =>
            {
                return(_temp.getCmd() == _command.cmd);
            });

            if (null != idc)
            {
                idc.Name = _command.name;
            }
        }
示例#4
0
        void cbCmd_SelectedIndexChanged(object sender, EventArgs e)
        {
            string name = (string)this.cbCmd.SelectedItem;

            if (name != null)
            {
                CommandMatch cmd = pList.Find((_cmd) =>
                {
                    return(_cmd.name == name);
                });
                if (cmd != null)
                {
                    this.txtCmd.Text = cmd.cmd;
                }
            }
        }
示例#5
0
        public static bool updateCommand(List<CommandMatch> list, CommandMatch cmd)
        {
            //首先要保证协议内同一个命令不能两次出现
            bool b = list.Exists((_cmd) =>
                {
                    return cmd.cmd == _cmd.cmd;
                });
            if (!b)
            {
                CommandMatch temp = list.Find((_cmd) =>
                {
                    return cmd.name == _cmd.name;
                });
                if (temp != null)
                {
                    temp.cmd = cmd.cmd;
                    DeviceCommandManager.matchCommand(cmd);
                    return true;
                }
            }

            return false;
        }
示例#6
0
        public static bool updateCommand(List <CommandMatch> list, CommandMatch cmd)
        {
            //首先要保证协议内同一个命令不能两次出现
            bool b = list.Exists((_cmd) =>
            {
                return(cmd.cmd == _cmd.cmd);
            });

            if (!b)
            {
                CommandMatch temp = list.Find((_cmd) =>
                {
                    return(cmd.name == _cmd.name);
                });
                if (temp != null)
                {
                    temp.cmd = cmd.cmd;
                    DeviceCommandManager.matchCommand(cmd);
                    return(true);
                }
            }

            return(false);
        }
示例#7
0
 public static void matchCommand(CommandMatch _command)
 {
     if (null == _command) return;
     IDeviceCommand idc = DeviceCommandList.Find((_temp) =>
     {
         return _temp.getCmd() == _command.cmd;
     });
     if (null != idc)
     {
         idc.Name = _command.name;
     }
 }