Exemplo n.º 1
0
        //Update the current view

        private void CadetBranchesListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            LoadingRing.IsActive = true;
            var selectedHouse = (sender as ListBox).SelectedItem as House;

            HousesListBox.ItemsSource  = HousesList;
            HousesListBox.SelectedItem = HousesList.Find(x => x == selectedHouse);
            LoadingRing.IsActive       = false;
        }
Exemplo n.º 2
0
        //Fill the boxes with the information of the house
        private async void showHouseInfo(House selected)
        {
            //Textblocks
            DiedOutTextBox.Text = selected.diedOut;
            FoundedTextBox.Text = selected.founded;

            WordsTextBox.Text      = selected.words;
            CoatOfArmsTextBox.Text = selected.coatOfArms;
            RegionTextBox.Text     = selected.region;
            NameTextBox.Text       = selected.name;
            //ListBoxes
            AncestralWeaponsListBox.ItemsSource = selected.ancestralWeapons;
            SeatsListBox.ItemsSource            = selected.seats;
            TitlesListBox.ItemsSource           = selected.titles;
            /**Links***/

            //House
            CurrentLordListBox.Items.Clear();
            CadetBranchesListBox.Items.Clear();
            HeirListBox.Items.Clear();
            FounderListBox.Items.Clear();
            SwornMembersListBox.Items.Clear();

            foreach (var item in selected.cadetBranches)
            {
                var tmp = HousesList.Find(x => x.url == item);
                if (tmp != null)
                {
                    CadetBranchesListBox.Items.Add(tmp);
                }
            }
            OverlordListBox.Items.Clear();
            var overlord = HousesList.Find(x => x.url == selected.overlord);

            OverlordListBox.Items.Clear();
            if (overlord != null)
            {
                OverlordListBox.Items.Add(overlord);
            }

            //Character
            var service = new GoTService();

            foreach (var item in selected.swornMembers)
            {
                if (item != "")
                {
                    SwornMembersListBox.Items.Add(await service.GetCharacterAsync(item));
                }
            }
            if (selected.founder != "")
            {
                FounderListBox.Items.Add(await service.GetCharacterAsync(selected.founder));
            }

            if (selected.heir != "")
            {
                HeirListBox.Items.Add(service.GetCharacterAsync(selected.heir));
            }

            if (selected.currentLord != "")
            {
                CurrentLordListBox.Items.Add(await service.GetCharacterAsync(selected.currentLord));
            }
        }