public TaskListViewModel()
        {
            Users = new List<User>() { SelectedUser };
            _tasks = new List<Task>();

            var u1 = new User { Id = 1,Name = "Ivan" };
            var u2 = new User { Id = 2, Name = "Ines" };

            Users.Add(u1);
            Users.Add(u2);

            var t1 = new Task("Clean kitchen", u1);
            var t2 = new Task("Wash dishes", u1);
            var t3 = new Task("Watch tv", u2);

            _tasks.Add(t1);
            _tasks.Add(t2);
            _tasks.Add(t3);

            TasksView = CollectionViewSource.GetDefaultView(_tasks);
            TasksView.Filter = FilterTasks; // Attach the FilterTasks method to the TasksView.Filter
        }
示例#2
0
 /// <summary>
 /// A task can't be created without a description and an owner
 /// </summary>
 /// <param name="description"></param>
 /// <param name="owner"></param>
 public Task(string description, User owner)
 {
     DateStarted = DateTime.Now;
     Description = description;
     Owner = owner;
 }