public void OpenOrderForm() { OrderFormWindow orderFormWindow = new OrderFormWindow(); orderFormWindow.DataContext = OrderFormViewModel; orderFormWindow.ShowDialog(); }
private void OrderEdit_Click(object sender, RoutedEventArgs e) { Order order = ((FrameworkElement)sender).DataContext as Order; OrderFormWindow orderWindow = new OrderFormWindow(order.Id); orderWindow.ShowDialog(); if (orderWindow.DialogResult.HasValue && orderWindow.DialogResult.Value) { order = orderWindow.Order; PlannerRequester.UpdateOrder(order); } Refresh(); }
public void OpenOrderForm() { OrderFormWindow orderFormWindow = new OrderFormWindow(); orderFormWindow.DataContext = OrderFormViewModel; if (!(orderFormWindow.ShowDialog() is true)) { if (CurrentOrder.ID == 0) { Orders.Remove(CurrentOrder); if (Orders.Count() > 0) { CurrentOrder = Orders.First(); } else { CurrentOrder = null; } } } }