Ejemplo n.º 1
0
        private async Task GetCategories()
        {
            availableCategories = await RequirementsBazaar.GetProjectCategories(projectId, 0, 20);

            categoryDropdown.options = new List <Dropdown.OptionData>();
            for (int i = 0; i < availableCategories.Length; i++)
            {
                categoryDropdown.options.Add(new Dropdown.OptionData(availableCategories[i].Name));
            }
            categoryDropdown.RefreshShownValue();
        }
Ejemplo n.º 2
0
        private async void UpdateDisplay()
        {
            // disable all interactive controls so that the user cannot invoke multiple asynchronous commands at once
            upButton.enabled   = false;
            downButton.enabled = false;
            // delete the currently shown category elements so that new category display can be shown instead
            ClearCategoryDisplayElements();

            // get the current page and the next page
            // the next page is required to check if we are on the last page and to enable/disable downButton accordingly
            currentPage = await RequirementsBazaar.GetProjectCategories(projectId, page, categoriesPerPage);

            nextPage = await RequirementsBazaar.GetProjectCategories(projectId, page + 1, categoriesPerPage);

            if (page == 0)
            {
                upButton.enabled = false;
            }
            else
            {
                upButton.enabled = true;
            }

            if (nextPage.Length == 0)
            {
                downButton.enabled = false;
            }
            else
            {
                downButton.enabled = true;
            }

            for (int i = 0; i < currentPage.Length; i++)
            {
                CreateCategoryDisplayElement(currentPage[i]);
            }
        }