private void FindListBox_MouseDoubleClick(object sender, MouseEventArgs e) { int n = FindListBox.IndexFromPoint(e.Location); if (n != ListBox.NoMatches) { FindListBox.SelectedIndex = n; var addTaskForm = new AddTaskForm(_diaryPreferences); addTaskForm.DiaryTask = _displayedFindDiaryTaskList.TaskList[n]; var changedTask = _displayedFindDiaryTaskList.TaskList[n]; if (addTaskForm.ShowDialog() == DialogResult.OK) { var index = _diaryTaskList.TaskList.FindIndex(x => CompareDate(x.TaskDate, changedTask.TaskDate, true) && x.Name == changedTask.Name); RemoveDiaryTask(index); //_diaryTaskList.TaskList.RemoveAt(index); _diaryTaskList.TaskList.Add(addTaskForm.DiaryTask); _displayedFindDiaryTaskList.TaskList.RemoveAt(n); _displayedFindDiaryTaskList.TaskList.Add(addTaskForm.DiaryTask); Find_Click(sender, e); UpdateFindList(); _displayedDiaryTaskList = _diaryTaskList; UpdateMainList(); } } }
private void MonthCalendar1_DateSelected(object sender, DateRangeEventArgs e) { if (e.Start.Day == e.End.Day) { _displayedDiaryTaskList = new DiaryTaskListContainer(); foreach (var task in _diaryTaskList.TaskList) { if (CompareDate(task.TaskDate, e.Start, false)) { _displayedDiaryTaskList.TaskList.Add(task); } } UpdateMainList(); } else { _displayedDiaryTaskList = new DiaryTaskListContainer(); foreach (var task in _diaryTaskList.TaskList) { if ((e.End.Day >= task.TaskDate.Day && task.TaskDate.Day >= e.Start.Day) && (e.End.Year >= task.TaskDate.Year && task.TaskDate.Year >= e.Start.Year) && (e.End.Month >= task.TaskDate.Month && task.TaskDate.Month >= e.Start.Month)) { _displayedDiaryTaskList.TaskList.Add(task); } UpdateMainList(); } } }
public void ConstructorWithArgsTaskListTest() { DiaryTaskListContainer diaryTaskList = new DiaryTaskListContainer(_diaryTasks); for (int i = 0; i < diaryTaskList.TaskList.Count; i++) { Assert.AreEqual(_diaryTasks[i].Name, diaryTaskList.TaskList[i].Name); } }
private void Add_Click(object sender, EventArgs e) { var addTaskForm = new AddTaskForm(_diaryPreferences); if (addTaskForm.ShowDialog() == DialogResult.OK) { _diaryTaskList.TaskList.Add(addTaskForm.DiaryTask); _displayedDiaryTaskList = _diaryTaskList; UpdateMainList(); } }
private void Find_Click(object sender, EventArgs e) { if (FindTextBox.Text.Trim().Length != 0) { _displayedFindDiaryTaskList = new DiaryTaskListContainer(); foreach (var item in _diaryTaskList.TaskList) { if (item.Name.Contains(FindTextBox.Text.Trim())) { _displayedFindDiaryTaskList.TaskList.Add(item); } } UpdateFindList(); } }
public void Setup() { _diaryPreferences = new DiaryPreferences(@"C:\Users\Valeriy\Desktop\diary\diary\DiaryApp\DiaryAppUnitTests" + @"\Ring.mp3" , Color.Green , Color.LightSalmon); string name = ""; for (int i = 0; i < 3; i++) { name = i.ToString(); _diaryTask = new DiaryTask(name, DateTime.Now, false); _diaryTasks.Add(_diaryTask); } _diaryTaskList = new DiaryTaskListContainer(_diaryTasks); //File.CreateText(@"D:\games\DiaryTest.diary"); }
public void ConstructorTaskListTest() { DiaryTaskListContainer diaryTaskList = new DiaryTaskListContainer(); Assert.AreEqual(0, diaryTaskList.TaskList.Count); }
private void ShowAllButton_Click(object sender, EventArgs e) { _displayedDiaryTaskList = _diaryTaskList; UpdateMainList(); }