Ejemplo n.º 1
0
        public async void LoadDirectory()
        {
            if (IsBusy)
            {
                return;
            }
            try
            {
                IsBusy = true;
                PurchaseOrders.Clear();
                await Task.Delay(100).ConfigureAwait(false);

                var directory = await PurchaseOrderDirectoryService.LoadPurchaseOrderDirectory();

                var index = 0;
                Device.BeginInvokeOnMainThread(() =>
                {
                    foreach (var purchaseOrder in directory.PurchaseOrders)
                    {
                        purchaseOrder.Index = index;
                        PurchaseOrders.Add(purchaseOrder);
                        index++;
                    }
                });
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 2
0
        public async Task Save(PurchaseOrderItem item)
        {
            if (IsBusy)
            {
                return;
            }
            try
            {
                IsBusy = true;
                await Task.Delay(100).ConfigureAwait(false);

                await PurchaseOrderDirectoryService.Save(item);
            }
            finally
            {
                IsBusy = false;
            }
        }