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