private void btnNew_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(NewTaskName) && !string.IsNullOrWhiteSpace(_status.CurrentContextId)) { var task = new AttiLA.Data.Entities.Task { CreationDateTime = DateTime.Now, TaskName = NewTaskName }; task.Contexts.Add(new ObjectId(_status.CurrentContextId)); try { _taskService.Create(task); } catch { _status.NotifyIcon.ShowBalloonTip(Properties.Resources.PopupWarning, "Error during task creation.", BalloonIcon.Warning); } if (null != this.PropertyChanged) { PropertyChanged(this, new PropertyChangedEventArgs(Utils <ViewContextPage> .MemberName(s => s.ContextTasks))); PropertyChanged(this, new PropertyChangedEventArgs(Utils <ViewContextPage> .MemberName(s => s.ExistingTasks))); NewTaskName = ""; PropertyChanged(this, new PropertyChangedEventArgs(Utils <ViewContextPage> .MemberName(s => s.NewTaskName))); } } }
private void _createButton_Click(object sender, EventArgs e) { InputDialog dialog = new InputDialog { WindowTitle = "Create new task", Content = "Insert the task name:" }; var result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { var taskName = dialog.Input; if (string.IsNullOrWhiteSpace(taskName)) { MessageBox.Show("Operation aborted."); } else { var task = new AttiLA.Data.Entities.Task { TaskName = taskName, CreationDateTime = DateTime.Now }; _taskService.Create(task); UpdateTaskList(); } } }
public void UpdateTaskList() { _tasksCommonBox.Items.Clear(); SelectedTask = null; var tasks = _taskService.GetTaskDetails(int.MaxValue, 0); foreach (var task in tasks) { var item = new ComboBoxItem <AttiLA.Data.Entities.Task>(task.TaskName, task); _tasksCommonBox.Items.Add(item); } }
private void _tasksCommonBox_SelectedIndexChanged(object sender, EventArgs e) { var item = (ComboBoxItem <AttiLA.Data.Entities.Task>)_tasksCommonBox.SelectedItem; SelectedTask = item.HiddenValue; }