public void SavePressed()
        {
            if (_edit == false) // new task
            {
                _task.SourceId = string.Format("{0}{1}{2}", DateTime.Now, _task.DateRemainder, _task.Text);
                _task.Save();
            }
            else
            {
                _task.Update();
            }

            TimeEngine.FireTaskChangedEvent(_task);
            _changesMade = true;
            _window.Close();
        }
        public void DeleteSelectedTask()
        {
            string message = "Do you realy want to delete this task?";

            if (this.SelectedTasks.Count > 1)
            {
                message = "Do you realy want to delete these tasks?";
            }

            if (MessageBox.Show(message, "Question",
                                MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                // we can't use SelectedTasks, because we are changing selected items by
                // removing them from observable collection
                List <Task> currentSelection = new List <Task>(SelectedTasks);
                for (int i = 0; i < currentSelection.Count; i++)
                {
                    Task task = currentSelection[i];
                    task.Delete();
                    _tasks.Remove(task); // I think it should be slow
                    TimeEngine.FireTaskChangedEvent(task);
                }
            }
        }