//根据CfgCommand 初始化单个command private void initCommand(CommandCfg cmdcfg) { XCommand cmd = new XCommand(cmdcfg); commands.Add(cmd.CommandName, cmd); XRange range = getRangeByName(cmd.cfg.RangeName); range.setCommand(cmd); }
//根据名称获取COMMAND public XCommand getCommandByName(String name) { XCommand cmd = null; try { cmd = commands[name]; } catch (Exception) { System.Windows.Forms.MessageBox.Show("Command:" + name + "未注册!请检查配置!"); } return(cmd); }
//根据ActionCfg初始化单个Action private void initAction(ActionCfg cfg) { XAction action = ActionFactory.MakeAction(cfg, this); if (action == null) { statu = SysStatu.Error; return; } XCommand cmd = getCommandByName(cfg.CommandName); try { action.cmd = cmd; cmd = getCommandByName(cfg.CommandName); cmd.actions.Add(action.actionSeq, action); } catch (Exception) { MessageBox.Show("Action:" + action.ActionName + "与命令:" + cfg.CommandName + "绑定失败,请检查Action配置是否正确!"); return; } this.actions.Add(action.ActionName, action); }