private async void ExecuteEditPlan(object o) { if (!(o is PlanViewModel)) { return; } var editingPlan = o as PlanViewModel; //let's set up a little MVVM, cos that's what the cool kids are doing: var view = new AddPlanDialog { DataContext = new PlanViewModel() { Id = editingPlan.Id, MachineId = editingPlan.MachineId, EmployeeId = editingPlan.EmployeeId, ProductId = editingPlan.ProductId, ExpectedQuantity = editingPlan.ExpectedQuantity, ActualQuantity = editingPlan.ActualQuantity, StartTime = editingPlan.StartTime, EndTime = editingPlan.EndTime, IsProcessed = editingPlan.IsProcessed, //Employee = editingPlan.Employee, //Machine = editingPlan.Machine, //Product = editingPlan.Product } }; //show the dialog var result = await DialogHost.Show(view, "RootDialog", OpenedPlanDialogEventHandler, ClosingPlanDialogEventHandler); //check the result... Console.WriteLine("Dialog was closed, the CommandParameter used to close it was: " + (result ?? "NULL")); }
private async void ExecuteAddPlan(object o) { //let's set up a little MVVM, cos that's what the cool kids are doing: var view = new AddPlanDialog { DataContext = new PlanViewModel() }; //show the dialog var result = await DialogHost.Show(view, "RootDialog", OpenedPlanDialogEventHandler, ClosingPlanDialogEventHandler); //check the result... Console.WriteLine("Dialog was closed, the CommandParameter used to close it was: " + (result ?? "NULL")); }