private void Button_Edit_Click(object sender, RoutedEventArgs e) { if (DataGrid_DTServiceList.SelectedItem != null) { OrderCheckItemVM orderCheckItemVM = DataGrid_DTServiceList.SelectedItem as OrderCheckItemVM; if (orderCheckItemVM.Description.Split(',').Length > 1) { orderCheckItemVM.ServiceTime_First = DateTime.Parse(orderCheckItemVM.Description.Split(',')[0]); orderCheckItemVM.ServiceTime_Second = DateTime.Parse(orderCheckItemVM.Description.Split(',')[1]); } else { orderCheckItemVM.ServiceTime_First = DateTime.Parse(orderCheckItemVM.Description); } CSToolDistributionServiceMaintain uctlDTMaintain = new CSToolDistributionServiceMaintain(); uctlDTMaintain.OrderCheckItemVM = orderCheckItemVM; //uctlDTMaintain.Page = this; uctlDTMaintain.Dialog = Window.ShowDialog(ResOrderCheck.DialogTitle_DTMaitain, uctlDTMaintain, (obj, args) => { if (args.DialogResult == DialogResultType.OK) { this.DataGrid_DTServiceList.Bind(); } }); } else { Window.Alert("请选择要编辑的项。"); } }
private void Button_New_Click(object sender, RoutedEventArgs e) { OrderCheckItemVM orderCheckItemVM = new OrderCheckItemVM(); orderCheckItemVM.ReferenceType = ""; CSToolDistributionServiceMaintain uctlDTMaintain = new CSToolDistributionServiceMaintain(); uctlDTMaintain.OrderCheckItemVM = orderCheckItemVM; //uctlDTMaintain.Page = this; uctlDTMaintain.Dialog = Window.ShowDialog(ResOrderCheck.DialogTitle_DTMaitain, uctlDTMaintain, (obj, args) => { if (args.DialogResult == DialogResultType.OK && args.Data != null) { this.DataGrid_DTServiceList.Bind(); } }); }