public void dataGridTask_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left) { DataGridRow dgr = DataGridRow.GetRowContainingElement(e.OriginalSource as FrameworkElement); if (dgr != null) { CO_IA.Data.Task task = dgr.DataContext as CO_IA.Data.Task; if (task != null) { Window wnd; if (task.FormState == AT_BC.Data.FormState.Check) { wnd = new Task.TaskExecutedWindow(); } else { wnd = new Task.TaskEditWindow(); } wnd.DataContext = task; wnd.ShowDialog(this); } } } }
private void buttonAdd_Click(object sender, RoutedEventArgs e) { CO_IA.Data.Task task = new Data.Task(); task.ActivityGuid = RiasPortal.ModuleContainer.Activity.Guid; task.FormState = AT_BC.Data.FormState.None; task.Key = Utility.NewGuid(); task.TaskType = TaskType.Normal; task.Urgency = TaskUrgency.Normal; var wnd = new Task.TaskEditWindow(); wnd.DataContext = task; wnd.OnSaveNewTask += savedTask => { (this.dataGridTask.ItemsSource as System.Collections.ObjectModel.ObservableCollection <CO_IA.Data.Task>).Add(savedTask); }; wnd.ShowDialog(this); }
private void NewTask(TaskType taskType) { CO_IA.Data.Task task = new Data.Task(); task.ActivityGuid = RiasPortal.ModuleContainer.Activity.Guid; task.FormState = AT_BC.Data.FormState.None; task.Key = Utility.NewGuid(); task.TaskType = taskType; task.Urgency = TaskUrgency.Normal; if (taskType == TaskType.Disturb) { task.DisturbInfo = new TaskDisturbInfo(); } var wnd = new Task.TaskEditWindow(); wnd.DataContext = task; wnd.OnSaveNewTask += savedTask => { (this.dataGridTask.ItemsSource as System.Collections.ObjectModel.ObservableCollection <CO_IA.Data.Task>).Add(savedTask); }; wnd.ShowDialog(this); }