public void Insert(int index, EditCase editCase) { if (index < 0) { string errMsg = string.Format(Properties.Resources.ErrInsertCmdUnderMin, index, 0); Log.Error(errMsg); return; } if (index > CaseList.Count) { string errMsg = string.Format(Properties.Resources.ErrInsertCmdOverMax, index, CaseList.Count); Log.Error(errMsg); return; } if (null == editCase) { Log.Error(Properties.Resources.ErrInsertCmdNullCmd); return; } if (CaseList.Count >= Sugarism.CmdSwitch.MAX_COUNT_CASE) { string msg = string.Format(Properties.Resources.ErrInsertCaseOverMax, Sugarism.CmdSwitch.MAX_COUNT_CASE); Log.Error(msg); return; } CaseList.Insert(index, editCase); editCase.Owner = this; }
public void Insert(int index, CmdCase cmdCase) { if (index < 0) { string errMsg = string.Format(Properties.Resources.ErrInsertCmdUnderMin, index, 0); Log.Error(errMsg); return; } if (index > CaseList.Count) { string errMsg = string.Format(Properties.Resources.ErrInsertCmdOverMax, index, CaseList.Count); Log.Error(errMsg); return; } if (null == cmdCase) { Log.Error(Properties.Resources.ErrInsertCmdNullCmd); return; } if (CaseList.Count >= Sugarism.CmdSwitch.MAX_COUNT_CASE) { string msg = string.Format(Properties.Resources.ErrInsertCaseOverMax, Sugarism.CmdSwitch.MAX_COUNT_CASE); Log.Error(msg); return; } CaseList.Insert(index, cmdCase); cmdCase.Parent = this; insert(index, cmdCase.Model as Sugarism.CmdCase); OnPropertyChanged("ToText"); }