private async void MethodCleaningOrder() { await Task.Factory.StartNew(() => { try { Application.Current.Dispatcher.Invoke(() => { CollectionMSGR_PedidoDetalle.Clear(); SelectedESGR_ProductoSubCategoria = null; CollectionESGR_Producto.Clear(); ListVMSGR_PedidoDetalleDelete.Clear(); }); Total = 0; var Opcion = ESGR_Pedido.Opcion; if (Opcion == "I") { var NombreMesa = ESGR_Pedido.Identificador; var NumPersonas = ESGR_Pedido.Cubierto; ESGR_Pedido = new BSGR_Pedido().GetPedido(); ESGR_Pedido.Opcion = Opcion; ESGR_Pedido.Identificador = NombreMesa; ESGR_Pedido.Cubierto = NumPersonas; ESGR_Pedido.ESGR_PedidoTipo = SelectedESGR_PedidoTipo; } } catch (Exception ex) { CmpMessageBox.Show(SGRMessage.TitlePedido, ex.Message, CmpButton.Aceptar); } }); }
private async void MethodLoadProducto(ESGR_ProductoSubCategoria ESGR_ProductoSubCategoria, string Filtro = "%") { await Task.Factory.StartNew(() => { try { if (ESGR_ProductoSubCategoria == null) { Application.Current.Dispatcher.Invoke(() => { CollectionESGR_Producto.Clear(); }); return; } PropertyMetroProgressBarProducto = true; CollectionESGR_Producto.Source = new BSGR_Producto().GetCollectionProductoCartaDia(ESGR_ProductoSubCategoria, Filtro); PropertyMetroProgressBarProducto = false; } catch (Exception ex) { CmpMessageBox.Show(SGRMessage.TitlePedido, ex.Message, CmpButton.Aceptar); } }); }