private async void LoadOrders_Click(object sender, RoutedEventArgs e) { OrderLoadingProgress.Visibility = Visibility.Visible; var orderHandler = new OrderHandler(); var orderTask = Task<IEnumerable<Order>>.Factory.StartNew(() => { return orderHandler.GetAllOrders(); }); pageTitle.Text = "Order System - Loading..."; var orders = await orderTask; Orders.Items.Clear(); foreach (var order in orders) Orders.Items.Add(order); pageTitle.Text = "Order System - Loaded!"; OrderLoadingProgress.Visibility = Visibility.Collapsed; }
private async void LoadOrders_Click(object sender, RoutedEventArgs e) { OrderLoadingProgress.Visibility = Visibility.Visible; var orderHandler = new OrderHandler(); var orderTask = Task <IEnumerable <Order> > .Factory.StartNew(() => { return(orderHandler.GetAllOrders()); }); pageTitle.Text = "Order System - Loading..."; var orders = await orderTask; Orders.Items.Clear(); foreach (var order in orders) { Orders.Items.Add(order); } pageTitle.Text = "Order System - Loaded!"; OrderLoadingProgress.Visibility = Visibility.Collapsed; }