private void btnViewTask_Click(object sender, RoutedEventArgs e) { var cmFilterData = ((FrameworkElement)sender).DataContext as FilterResultItem; if (cmFilterData == null) { return; } var cmTask = CMDataProvider.DataStore.Value.CMTasks.Value.Get(cmFilterData.TaskId); var taskEditor = new TaskEditor(cmTask); // mcbtodo: keep track of open windows and just switch the already open one if it is, otherwise we open it here. taskEditor.Show(); }
private void btnEditTask_Click(object sender, RoutedEventArgs e) { var cmTask = ((FrameworkElement)sender).DataContext as FeatureEditorTaskRowDto; if (cmTask?.Task == null || cmTask.Task.Id == 0) { // Null: This means clicking on the button of a new row that has not yet been added into the database // ==0: Also a new row not yet in the db, but in a further state than the above. MessageBox.Show("A task must be fully entered before the editor can be invoked."); return; } // Currently we only allow 1 task editor template to be present at a time var taskEditor = new TaskEditor(cmTask.Task); taskEditor.ShowDialog(); // Reload the task rows. Without this the buttons won't refresh their text. Reload_Tasks(); }