Пример #1
0
        private async void LoadItems()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                RefreshItemsCommand.ChangeCanExecute();
                Items.Clear();
                var items = await _gallogClient.GetItemsAsync <TradeportList>();

                foreach (var item in items.tradeports.ToList())
                {
                    Items.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
                RefreshItemsCommand.ChangeCanExecute();
            }
        }
Пример #2
0
        private async void LoadItems()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            RefreshItemsCommand.ChangeCanExecute();

            try
            {
                Items.Clear();
                var items = await _gallogClient.GetItemsAsync <ShipList>();

                foreach (var item in items.ships.ToList())
                {
                    if (item.img == "")
                    {
                        item.img = "ph.png";
                    }
                    else
                    {
                        full_URL = "https://gallog.co/img/ships/" + item.img;
                        item.img = full_URL;
                    }
                    if (item.flyable == "1")
                    {
                        item.flyable = "Yes";
                        item.color   = "Black";
                        item.bgcolor = "#7bf964";
                    }
                    else
                    {
                        item.flyable = "No";
                        item.color   = "White";
                        item.bgcolor = "#dc494e";
                    }
                    if (item.value == "0.00")
                    {
                        item.value = "Price Says Broke";
                    }
                    if (item.value == null)
                    {
                        item.value = "Price Null";
                    }

                    Items.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
                RefreshItemsCommand.ChangeCanExecute();
            }
        }