Exemplo n.º 1
0
        private void reset(int characterId, IList <Sugarism.CmdCase> caseList)
        {
            // characterId
            if (Common.Instance.IsValidCharacter(characterId))
            {
                SelectedItem = CharacterList[characterId];
            }
            else
            {
                if (null == CharacterList)
                {
                    SelectedItem = null;
                }
                else if (CharacterList.Length > 0)
                {
                    SelectedItem = CharacterList[0];
                }
                else
                {
                    SelectedItem = null;
                }
            }

            // caseList
            CaseList.Clear();
            for (int i = 0; i < caseList.Count; ++i)
            {
                EditCase editCase = new EditCase(caseList[i].Key, caseList[i].Description);

                Insert(CaseList.Count, editCase);
            }
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        public void AddCase()
        {
            int key = CaseList.Count;

            EditCase cmdCase = new EditCase(key, string.Empty);

            int index = key;

            Insert(index, cmdCase);
        }
Exemplo n.º 4
0
        public void Delete(EditCase editCase)
        {
            if (CaseList.Count <= Sugarism.CmdSwitch.MIN_COUNT_CASE)
            {
                string msg = string.Format(Properties.Resources.ErrDeleteCaseUnderMin, Sugarism.CmdSwitch.MIN_COUNT_CASE);
                Log.Error(msg);
                return;
            }

            if (null != editCase)
            {
                editCase.Owner = null;
            }

            CaseList.Remove(editCase);    // List의 모든 element가 같은 object를 참조하는 경우는 없다고 가정.
        }