public UIElement GetAddView() { StockAddViewModel viewModel = new StockAddViewModel(); StockAddView view = new StockAddView(viewModel); viewModel.StockAdded += (s, ea) => OnAdd(Convert.ToInt32(ea.Data), viewModel); return(view); }
private void OnAdd(int stockNo, StockAddViewModel viewModel) { using (IStockController controller = factory.CreateStockController()) { ControllerMessage controllerMessage = controller.Add(stockNo); if (controllerMessage.IsSuccess) { viewModel.StockNo = String.Empty; Notify(); } else { MessageBox.Show(controllerMessage.Message); } } }
public StockAddView(StockAddViewModel viewModel) { InitializeComponent(); this.DataContext = viewModel; }