public void FixNpcs() { DispatcherHelper.CheckBeginInvokeOnUI( () => { int[] npcids = {17, 18, 19, 20, 22, 54, 38, 107, 108, 124, 160, 178, 207, 208, 209, 227, 228, 229}; foreach (int npcid in npcids) { if (CharacterNames.All(c => c.Id != npcid)) CharacterNames.Add(GetNewNpc(npcid)); } }); }
public void FixNpcs() { TEdit.MvvmLight.Threading.DispatcherHelper.CheckBeginInvokeOnUI( () => { int[] npcids = { 17, 18, 19, 20, 22, 54, 38, 107, 108, 124, 160, 178, 207, 208, 209, 227, 228, 229, 353, 369, 441 }; foreach (int npcid in npcids) { if (CharacterNames.All(c => c.Id != npcid)) { CharacterNames.Add(GetNewNpc(npcid)); } } }); }
public CharacterSelectionViewModel(MainWindowViewModel main) { this.main = main; this.ConfirmCommand = new DelegateCommand(this.PressConfirm); TxtReader charReader = new TxtReader(characterFile); characters = charReader.ReadCharacters(); UpdateCharacter(); foreach (var character in characters) { CharacterNames.Add(character.Name); } }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state) { //gets the book from the passed parameter string url = (string)parameter; var client = new GoTService(); CurrentBook = await client.GetBookByUrlAsync(url); foreach (var povCharacter in CurrentBook.PovCharacters) { Character c = await client.GetCharacterByUrlAsync(povCharacter); //Saves the name field to a collection that is shown on the UI PovCharacterNames.Add(c.Name); //Saves the entire type, needed for navigation _povCharacters.Add(c); } //sets a specific limit, so the app wont get overwhelmed with too much data int limit = 20; int i = 0; foreach (var character in CurrentBook.Characters) { if (i >= limit) { break; } Character c = await client.GetCharacterByUrlAsync(character); if (c.Name != "") { //Saves the name field to a collection that is shown on the UI CharacterNames.Add(c.Name); //Saves the entire type, needed for navigation _characters.Add(c); } i++; } await base.OnNavigatedToAsync(parameter, mode, state); }