private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            TaskItam ti = (TaskItam)listBoxToDoListBox.SelectedItem;
            MyToDo   my = _taskList[ti.labelTask.Content.ToString()];

            listBoxToDoListBox.Items.Remove(ti);
            _taskList.Remove(ti.labelTask.Content.ToString());
            _todoMeneger.RemoveTaskFromTable(my);
        }
Beispiel #2
0
        public void Remove(string s)
        {
            if (IsEmpty)
            {
                throw new NullReferenceException("List is Empty!");
            }

            MyToDo m = null;

            foreach (var item in myList)
            {
                if (item.Value == s)
                {
                    m = item;
                }
                else
                {
                    throw new Exception("string wasn't found!");
                }
            }
            myList.Remove(m);
        }