コード例 #1
0
        public async Task LoadData()
        {
            try
            {
                RestStatus status = await RestHub.Shipments();

                if (status.UserObject != null)
                {
                    List <BatchDTO> batches = (List <BatchDTO>)status.UserObject;
                    Batches = new ObservableCollection <Delivery.BatchVM>();
                    foreach (var batch in batches)
                    {
                        Batches.Add(new BatchVM
                        {
                            DateCreated   = batch.DateCreated,
                            DocumentsPath = batch.DocumentsPath,
                            Id            = batch.Id,
                            Name          = batch.Name
                        });
                    }
                }
                status = await RestHub.GetAllCurators();

                if (status.UserObject != null)
                {
                    List <UserDTO> curators = (List <UserDTO>)status.UserObject;
                    Curators = new ObservableCollection <Tasks.UsersVM>();
                    foreach (var user in curators)
                    {
                        Curators.Add(new UsersVM
                        {
                            UserId = user.UserID,
                            Role   = user.Role,
                            Name   = user.Name
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                Log.This(ex);
            }
        }