Exemplo n.º 1
0
        //First call to populate the list of customers
        async void Get()
        {
            // Local data
            IsLoading = true;

            var result = await CustomerStore.GetItemsAsync(FilterWeight, FilterGrade == null?null : GradeValues[FilterGrade], false);

            // Server refresh
            if (result == null || !result.Any())
            {
                if (FilterWeight == null && string.IsNullOrWhiteSpace(FilterGrade))
                {
                    LoadingText = AppResources.FetchingData;
                    result      = await CustomerStore.GetItemsAsync(FilterWeight, FilterGrade == null?null : GradeValues[FilterGrade], true);

                    CreateGroupedCollection(result);
                    LoadingText = AppResources.FetchingData;
                }
                else
                {
                    CreateGroupedCollection(result);
                }
            }
            else
            {
                CreateGroupedCollection(result);
            }

            IsLoading = false;
        }