public void Insert(int index, Command cmd) { if (index < 0) { string errMsg = string.Format(Properties.Resources.ErrInsertCmdUnderMin, index, 0); Log.Error(errMsg); return; } if (index > CmdList.Count) { string errMsg = string.Format(Properties.Resources.ErrInsertCmdOverMax, index, CmdList.Count); Log.Error(errMsg); return; } if (null == cmd) { Log.Error(Properties.Resources.ErrInsertCmdNullCmd); return; } CmdList.Insert(index, cmd); cmd.Owner = this; insert(index, cmd.Model); }