private void ListView_MouseUp(object sender, MouseButtonEventArgs e) { if (tabWeekylist.IsSelected) { if (btnMove.IsChecked == true && tvWeekylist.SelectedItem != null) { BussinessObject.Entities.Task task = tvWeekylist.SelectedItem as dynamic; dynamic data = sender as dynamic; DayInWeek dayInWeek = data.DataContext as DayInWeek; dynamic setTime = dpTime.SelectedDate; DateTime startDay = getDateTimeOfWeek(setTime, dayInWeek.DayName); Work work = new Work() { TaskId = task.Id, StartTime = startDay }; WeekyTaskData weekyTaskData = new WeekyTaskData(); if (weekyTaskData.MakeWorkFromWeekyTask(work)) { DayInWeek dataContext = data.DataContext as DayInWeek; DataTable dtId = weekyTaskData.GetInsertWorkId(); work.Id = dtId.Select()[0].ItemArray[0] as dynamic; dataContext.MorningTask.Add(new WeekyWork(task, work)); DateTime startTime = getDateTimeOfWeek(setTime, DayOfWeek.Monday); DateTime endTime = startTime.AddDays(7).Date; setProccess(startTime, endTime); //CollectionViewSource.GetDefaultView(dataContext.MorningTask).Refresh(); } } } }
public TaskForm(BussinessObject.Entities.Task task, ObservableCollection <BussinessObject.Entities.Task> nodeList) { InitializeComponent(); this.nodeList = nodeList; this.task = task; btnAdd.Visibility = Visibility.Hidden; txtTitle.Text = task.Title; txtDescription.Text = task.Description; }
private void tvWeekylist_Item_Selected(object sender, RoutedEventArgs e) { if (btnEdit.IsChecked == true) { dynamic data = sender; BussinessObject.Entities.Task task = data.SelectedItem; if (task.SuperTask == -1) { goalForm = new GoalForm(task, weekyList); goalForm.ShowDialog(); } else { taskForm = new TaskForm(task, weekyList); taskForm.ShowDialog(); SetWeeky(); } //todoForm.ShowDialog(); } }