private bool restoreContext(string name, Spinner spinner, ListMessage message, ListBox listBox)
 {
     object context;
     if (State.TryGetValue(name, out context)) {
         spinner.Visibility = Visibility.Collapsed;
         message.Visibility = Visibility.Collapsed;
         listBox.DataContext = context;
         listBox.Visibility = Visibility.Visible;
         return true;
     } else
         return false;
 }
        private void loadLegislators(Spinner spinner, ListBox listBox, ListMessage message, Collection<Legislator> legislators)
        {
            spinner.Visibility = Visibility.Collapsed;

            if (legislators != null) {

                if (legislators.Count > 0) {
                    listBox.Visibility = Visibility.Visible;
                    listBox.DataContext = LegislatorListViewModel.fromCollection(legislators);
                } else {
                    (message.FindName("Message") as TextBlock).Text = "No legislators found.";
                    message.Visibility = Visibility.Visible;
                }

            } else {
                (message.FindName("Message") as TextBlock).Text = "There was a problem loading legislator information.";
                message.Visibility = Visibility.Visible;
            }
        }
コード例 #3
0
        private void loadCommittees(Collection<Committee> committees, Spinner spinner, ListBox listBox, ListMessage message)
        {
            spinner.Visibility = Visibility.Collapsed;

            if (committees != null) {
                if (committees.Count > 0) {
                    listBox.Visibility = Visibility.Visible;
                    listBox.DataContext = CommitteeListViewModel.fromCollection(committees);
                } else {
                    (message.FindName("Message") as TextBlock).Text = "No committees found.";
                    message.Visibility = Visibility.Visible;
                }
            } else {
                (message.FindName("Message") as TextBlock).Text = "There was a problem loading committee information.";
                message.Visibility = Visibility.Visible;
            }
        }