示例#1
0
        private async void LoadCategory()
        {
            try
            {
                IsBussy = true;
                ServiceClient client = new ServiceClient();
                var           status = await IsConnection.ConnectionAsync();

                if (status)
                {
                    IsVisibleConnection = false;
                    IsVisibleList       = true;
                    ListCategory        = new ObservableCollection <CategoryModel>();
                    var response = await client.Get <ListCategory>("/shopping/api/category/categoryall");

                    IsBussy = false;
                    if (response != null)
                    {
                        if (response.Result != null && response.Count > 0)
                        {
                            ListCategory.Clear();
                            foreach (var item in response.Result)
                            {
                                ListCategory.Add(item);
                            }
                        }
                        else
                        {
                        }
                    }
                }
                else
                {
                    IsBussy             = false;
                    IsVisibleConnection = true;
                    IsVisibleList       = false;
                }
            }
            catch (Exception ex)
            {
                IsBussy = false;
                throw ex;
            }
        }
示例#2
0
        private async void LoadData()
        {
            try
            {
                var status = await IsConnection.ConnectionAsync();

                if (status)
                {
                    IsVisibleList       = true;
                    IsVisibleConnection = false;
                }
                else
                {
                    IsVisibleList       = false;
                    IsVisibleConnection = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }