public ListBillPage() { List <string> list_Filter = new List <string>() { "All Bill here", "Completely Bill", "Not completely Bill", "Recently Bill", "Longest Bill", "Canceled Bill", "Buy online", "Buy at shop" }; InitializeComponent(); EnableTextbox(false); Thread loadBill = new Thread(delegate() { int Arrangeindex = 0; Dispatcher.Invoke(() => { Arrangeindex = comboFilter.SelectedIndex; }); Bills = manage.Arrange_ListBill(Arrangeindex); Dispatcher.Invoke(() => { comboFilter.ItemsSource = list_Filter; listBill.ItemsSource = Bills; ProgressBar.IsEnabled = false; ProgressBar.Visibility = Visibility.Hidden; }); }); loadBill.Start(); }
private void ComboFilter_SelectionChanged(object sender, SelectionChangedEventArgs e) { listBill.ItemsSource = null; ProgressBar.IsEnabled = true; ProgressBar.Visibility = Visibility.Visible; Thread thread = new Thread(delegate() { Manage_Product dbProduct = new Manage_Product(); int Arrangeindex = 0; Dispatcher.Invoke(() => { Arrangeindex = comboFilter.SelectedIndex; }); Bills = dbProduct.Arrange_ListBill(Arrangeindex); Dispatcher.Invoke(() => { listBill.ItemsSource = Bills; ProgressBar.IsEnabled = false; ProgressBar.Visibility = Visibility.Hidden; }); }); thread.Start(); }