private async void LoadProdutos() { wb = new WaitBox(); wb.Owner = Window.GetWindow(this); wb.Show(); await Task.Run(() => { listaProdutos = bll.LoadProdutos(); }); lstProdutos.ItemsSource = listaProdutos; wb.Close(); }
public PrecificarProdutos() { InitializeComponent(); new Thread(() => { Dispatcher.Invoke(new Action(() => { wb = new WaitBox(); wb.Owner = Window.GetWindow(this); wb.Show(); })); syncEvent.Set(); Dispatcher.Invoke(DispatcherPriority.Background, new Action(() => { listaProdutos = bll.LoadProdutos(); t1 = new Thread(WaitLoad); t1.Start(); })); }).Start(); }