示例#1
0
        private void OnLoad(object _)
        {
            IsLoading = true;

            Task <List <Employee> > .Factory.StartNew(
                () =>
            {
                return(EmployeeService.GetEmployees());
            },
                TaskCreationOptions.LongRunning)
            .ContinueWith(
                task =>
            {
                foreach (var employee in task.Result)
                {
                    Employees.Add(EmployeeViewModel.FromEmployee(employee));
                }
                IsLoading = false;
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }