public void AddTaskList(DbLibrary.Task task) { listTask.Add(task); lbTasks.ItemsSource = null; lbTasks.ItemsSource = listTask; tbTasks.Text = ""; }
private void lbTasks_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (lbTasks.SelectedIndex >= 0) { DbLibrary.Task task = (DbLibrary.Task)lbTasks.SelectedItem; //tbTasks.Text = task.ForTextBoxToString(); } }
private void btnDeleteTask_Click(object sender, RoutedEventArgs e) { if (lbTasks.SelectedIndex >= 0) { DbLibrary.Task task = (DbLibrary.Task)lbTasks.SelectedItem; MessageBoxResult res = MessageBox.Show("Do you realy want to delete this Task: " + task.ToString(), "Delete task", MessageBoxButton.OKCancel); if (res == MessageBoxResult.OK) { DbLink.DeleteEmployee(task); listTask.Remove(task); UpdateTaskList(); } } else { MessageBox.Show("Choose a task"); } }
public AddTaskWindow(string mode = "add", DbLibrary.Task task = null) { InitializeComponent(); this.mode = mode; if (mode == "add") { this.Title = "Добавить задачу"; this.task = new DbLibrary.Task(); } else { this.task = task; this.Title = "Редактирование данные"; tbTitle.Text = task.Title; tbDateBegin.Text = task.DateBegin.ToString(); tbDateEnd.Text = task.DateEnd.ToString(); tbCustomer.Text = task.Customer; tbPhoneCustomer.Text = task.PhoneCustomer; } }