private void buttonAdd_Click(object sender, RoutedEventArgs e) { ActivityPlaceInfo placeInfo = this.listBoxPlace.SelectedValue as ActivityPlaceInfo; if (placeInfo == null) { MessageBox.Show("请选择要生成监测预案的区域"); return; } var monitorPlan = CreateMonitorPlan(placeInfo); var wnd = new Monitor.MonitorPlanEditWindow(); wnd.DataContext = monitorPlan; if (wnd.ShowDialog(this) == true) { PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.MonitorTask.I_CO_IA_MonitorTask>(channel => { channel.SaveMonitorPlan(monitorPlan); }); (this.dataGridMonitorPlan.ItemsSource as ObservableCollection <MonitorPlanInfo>).Add(monitorPlan); } }
public void dataGridMonitorPlan_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left) { DataGridRow dgr = DataGridRow.GetRowContainingElement(e.OriginalSource as FrameworkElement); if (dgr != null) { MonitorPlanInfo monitorPlan = dgr.DataContext as MonitorPlanInfo; if (monitorPlan != null) { var wnd = new Monitor.MonitorPlanEditWindow(); wnd.DataContext = monitorPlan; if (wnd.ShowDialog(this) == true) { PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.MonitorTask.I_CO_IA_MonitorTask>(channel => { channel.SaveMonitorPlan(monitorPlan); }); } //this.OpenTemplateManageModule(activity); } } } }