Exemplo n.º 1
0
        private async Task RefreshCharacterProfessions()
        {
            CharacterProfessions.Clear();
            CharacterProfessionsName.Clear();
            var characterProfessionApiServises = new CharacterProfessionApiServises();
            var characterProfessions           = await characterProfessionApiServises.SelectCharacterProfessionsAsync();

            var sortedCharacterProfessions = from cP in characterProfessions
                                             orderby cP.Name
                                             select cP;

            foreach (var characterProfession in sortedCharacterProfessions)
            {
                CharacterProfessionsName.Add(characterProfession.Name);
                CharacterProfessions.Add(characterProfession);
            }
        }
        public async Task ExecuteLoadItemsCommand()
        {
            IsBusy = true;

            try
            {
                Professions.Clear();
                var professionsApiServises = new CharacterProfessionApiServises();
                var professions            = await professionsApiServises.SelectCharacterProfessionsAsync();

                foreach (var profession in professions)
                {
                    Professions.Add(profession);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }