Esempio n. 1
0
        /// <summary>
        /// 케이스 초기화
        /// </summary>
        private async void InitializeCases()
        {
            var storageFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;

            if (await storageFolder.FileExistsAsync("case1.csv") == false)
            {
                return;
            }
            var fileText = await storageFolder.ReadTextFromFileAsync("case1.csv");

            var lines = fileText.Split('\n');

            CaseList?.Clear();
            for (int i = 0; i < lines.Length; i++)
            {
                if (lines[i].Length == 0)
                {
                    continue;
                }
                var columns = lines[i].Replace("\r", "").Split(',');
                var newCase = new Case
                {
                    Index     = Convert.ToInt16(columns[0]),
                    ShowText  = columns[1],
                    SpeakText = columns[2]
                };
                CaseList.Add(newCase);
            }
        }
Esempio n. 2
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);
            }
        }