Esempio n. 1
0
        public TasksViewModel()
        {
            NewTasksLoading = BackgroundTaskDescriptor <TasksViewModel, IEnumerable <V_Task> >
                              .RegisterDescriptor(this, "Ładowanie nowych zadań", () => GetTasks(Data.Enums.TaskState.New))
                              .OnCompleted((vm, res) => { vm.NewTasks = new ObservableCollection <V_Task>(res); });

            ActiveTasksLoading = BackgroundTaskDescriptor <TasksViewModel, IEnumerable <V_Task> >
                                 .RegisterDescriptor(this, "Ładowanie aktywnych zadań", () => GetTasks(Data.Enums.TaskState.Active))
                                 .OnCompleted((vm, res) => { vm.ActiveTasks = new ObservableCollection <V_Task>(res); });

            SuspendTasksLoading = BackgroundTaskDescriptor <TasksViewModel, IEnumerable <V_Task> >
                                  .RegisterDescriptor(this, "Ładowanie wstrzymanych zadań", () => GetTasks(Data.Enums.TaskState.Suspend))
                                  .OnCompleted((vm, res) => { vm.SuspendTasks = new ObservableCollection <V_Task>(res); });

            CompleteTasksLoading = BackgroundTaskDescriptor <TasksViewModel, IEnumerable <V_Task> >
                                   .RegisterDescriptor(this, "Ładowanie zakończonych zadań", () => GetTasks(Data.Enums.TaskState.Complete))
                                   .OnCompleted((vm, res) => { vm.CompleteTasks = new ObservableCollection <V_Task>(res); });

            ProjectLoading = BackgroundTaskDescriptor <TasksViewModel, IEnumerable <V_Project> >
                             .RegisterDescriptor(this, "Ładowanie projektów", GetProjects)
                             .OnCompleted((vm, res) =>
            {
                vm.Projects  = res;
                vm.ProjectId = res.FirstOrDefault().Id;
            });

            ProjectLoading.Invoke();
        }
Esempio n. 2
0
 protected virtual void OnProjectLoading()
 {
     ProjectLoading?.Invoke(this, EventArgs.Empty);
 }