private void BtnEdit_Click(object sender, RoutedEventArgs e) { object o = listView1.SelectedItem; if (o == null) { return; } JobDetails item = o as JobDetails; if (item.IsRunning) { System.Windows.MessageBox.Show("无法编辑该任务!", "OKEGui", MessageBoxButton.OK, MessageBoxImage.Error); return; } SubWindow subWin = new SubWindow(item); subWin.ShowDialog(); if (!tm.UpdateTask(subWin.GetNewTaskDetail())) { System.Windows.MessageBox.Show("任务更新失败!", "OKEGui", MessageBoxButton.OK, MessageBoxImage.Error); } return; }
private void listView1_MouseDoubleClick(object sender, MouseButtonEventArgs e) { object o = listView1.SelectedItem; if (o == null) { return; } JobDetails item = o as JobDetails; SubWindow subWin = new SubWindow(item); subWin.ShowDialog(); if (!tm.UpdateTask(subWin.GetNewTaskDetail())) { System.Windows.MessageBox.Show("任务更新失败!", "任务详细", MessageBoxButton.OK, MessageBoxImage.Error); } return; }