コード例 #1
0
        /// <summary>
        /// @Author: Phillip Hansen
        ///
        /// This specific constructor is for retrieving a performance
        /// for an Event with that performance
        /// </summary>
        /// <param name="filterText"></param>
        public PerformanceViewer(string filterText)
        {
            InitializeComponent();

            this.btnBack.Content = "Select Performance";
            txtSearch.IsEnabled  = false;
            txtSearch.Text       = filterText;

            List <Performance> _filteredPerformances = new List <Performance>();

            foreach (var item in performanceManager.RetrieveAllPerformance().Where(p => p.Name.Equals(filterText)))
            {
                _filteredPerformances.Add(item);
            }
            try
            {
                dgPerformaces.ItemsSource = null;
                dgPerformaces.Items.Refresh();

                dgPerformaces.ItemsSource = _filteredPerformances;
                dgPerformaces.Items.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\nCould not populate filtered Performances");
            }
        }