public async void LoadData() { try { #region Batches FromBatches = new ObservableCollection <BatchVM>(); ToBatches = new ObservableCollection <BatchVM>(); DeliveryBatches = new ObservableCollection <DeliveryBatchVM>(); #region Shipment Batches var result = await RestHub.Batches(); if (result.HttpCode == System.Net.HttpStatusCode.OK) { List <BatchDTO> batches = (List <BatchDTO>)result.UserObject; batches = batches.OrderByDescending(b => b.Name).ToList(); foreach (var batchDto in batches) { FromBatches.Add(new BatchVM { Id = batchDto.Id, DateCreated = batchDto.DateCreated, Name = batchDto.Name, DocumentsPath = batchDto.DocumentsPath }); } FromBatch = FromBatches.FirstOrDefault(); foreach (var batchDto in batches) { ToBatches.Add(new BatchVM { Id = batchDto.Id, DateCreated = batchDto.DateCreated, Name = batchDto.Name, DocumentsPath = batchDto.DocumentsPath }); } ToBatch = ToBatches.FirstOrDefault(); UpdateSummary(BatchTans); } else { AppErrorBox.ShowErrorMessage("Can't Load Batches . .", result.StatusMessage); } #endregion #region Delivery Batches LoadDeliveryBatches(); #endregion #endregion #region Categories FromCategories = new ObservableCollection <TanCategoryVM>(); ToCategories = new ObservableCollection <TanCategoryVM>(); foreach (TanCategory tanCategory in Enum.GetValues(typeof(TanCategory))) { FromCategories.Add(new TanCategoryVM { Value = (int)tanCategory, Description = tanCategory.DescriptionAttribute() }); } FromCategory = new TanCategoryVM { Value = (int)TanCategory.Progress, Description = TanCategory.Progress.DescriptionAttribute() }; ToCategories.Add(new TanCategoryVM { Value = (int)TanCategory.Patents, Description = TanCategory.Patents.DescriptionAttribute() }); ToCategories.Add(new TanCategoryVM { Value = (int)TanCategory.Journals, Description = TanCategory.Journals.DescriptionAttribute() }); ToCategory = null; #endregion } catch (Exception ex) { Log.This(ex); } }