Ejemplo n.º 1
0
        private async Task GetAllAudio(int paging)
        {
            string ret = string.Empty;

            StaticMethods.ShowLoader();
            Task.Factory.StartNew(
                // tasks allow you to use the lambda syntax to pass wor
                () =>
            {
                listAudio = WebService.GetAllAudios(paging);
            }).ContinueWith(
                t =>
            {
                if (listAudio != null)
                {
                    for (int i = 0; i < listAudio.Count; i++)
                    {
                        listAudio[i].image_path = Constants.SERVER_IMG_URL + listAudio[i].image_path;
                    }
                    items = new AllAudioItems(listAudio);
                    flowlistview.FlowItemsSource = items.Items;
                }
                else
                {
                    StaticMethods.ShowToast("Something went wrong. Plese try agan later!");
                }
            }, TaskScheduler.FromCurrentSynchronizationContext()
                );
        }
Ejemplo n.º 2
0
        private async Task SearchAudio()
        {
            pagenumber = 0;

            string ret = string.Empty;

            StaticMethods.ShowLoader();
            Task.Factory.StartNew(
                // tasks allow you to use the lambda syntax to pass wor
                () =>
            {
                for (int i = 0; i < arrayCategory.Length; i++)
                {
                    if (arrayCategory[i] == lblCategory.Text)
                    {
                        category = i.ToString();
                    }
                }


                for (int j = 0; j < arrayTypeofAudio.Length; j++)
                {
                    if (arrayTypeofAudio[j] == lblType.Text)
                    {
                        type = j.ToString();
                    }
                }

                if (type == "0")
                {
                    type = "";
                }

                if (category == "0")
                {
                    category = "";
                }
                else if (category == "13")
                {
                    category = "0";
                }

                listAudio = WebService.GetSearchAudios(type, category, txtSearch.Text);
            }).ContinueWith(
                t =>
            {
                if (listAudio != null)
                {
                    if (category == "0")
                    {
                        pagenumber = 1;
                    }


                    for (int i = 0; i < listAudio.Count; i++)
                    {
                        listAudio[i].image_path = Constants.SERVER_IMG_URL + listAudio[i].image_path;
                    }
                    items = new AllAudioItems(listAudio);
                    flowlistview.FlowItemsSource = items.Items;
                }
                else
                {
                    StaticMethods.ShowToast("Something went wrong. Plese try agan later!");
                }
            }, TaskScheduler.FromCurrentSynchronizationContext()
                );
        }