Esempio n. 1
0
        private void Load()
        {
            var pst = new PeopleSearchTool(FormattedSearchTerms);
            List <PersonModel> foundPeople = null;

            foundPeople = pst.SearchResults;

            if (foundPeople != null && foundPeople.Count > 0)
            {
                FoundPeople = foundPeople;
            }
            else
            {
                FoundPeople = new List <PersonModel>();
            }
        }
        private void GetDetailsButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (DetailsWindowIsOpen)
                {
                    PersonDetailsTextbox.Text      = string.Empty;
                    DetailsWindowIsOpen            = false;
                    GetDetailsButton.Content       = DefaultButtonText;
                    PeopleDetailsBorder.Visibility = Visibility.Collapsed;
                    return;
                }

                var selectedPerson = FoundPeopleDataGrid.SelectedItem as PersonModel;
                var outputMessage  = new StringBuilder();

                if (selectedPerson != null)
                {
                    outputMessage.Append(PeopleSearchTool.GetPersonDetails(selectedPerson));
                }
                else
                {
                    outputMessage.AppendLine("Select an item first.");
                }

                PersonDetailsTextbox.Text      = outputMessage.ToString();
                DetailsWindowIsOpen            = true;
                GetDetailsButton.Content       = "Click here to close the details bubble.";
                PeopleDetailsBorder.Visibility = Visibility.Visible;
            }
            catch
            {
                DetailsWindowIsOpen = false;
                MessageBox.Show("Something went wrong. Call the developer.");
            }
        }