示例#1
0
        private void initBandRecommendation()
        {
            recomendedListView  = FindViewById <ListView> (Resource.Id.reccomendedListView);
            recommendedBandList = MusicoConnUtil.SearchBandsAsync("saskatoon", null, 0, 9999999, 0, new DateTime(), null);



            int maxBands = 5;

            if (recommendedBandList.Count < 5)
            {
                maxBands = recommendedBandList.Count;
            }

            string[] items = new string[maxBands];
            for (int i = 0; i < maxBands; i++)
            {
                items [i] = recommendedBandList [i].Name;
            }

            //ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItem1, items);


            CustomListAdapter listAdapter = new CustomListAdapter(this, items);


            recomendedListView.SetAdapter(listAdapter);
            recomendedListView.Clickable  = true;
            recomendedListView.ItemClick += RecomendedListView_ItemClick;
        }
示例#2
0
        void SearchBTN_Click(object sender, EventArgs e)
        {
            List <Band> foundBands;

            name = null;

            if (nameTV.Text.Length > 0)
            {
                name = nameTV.Text;
            }

            genre = null;

            if (genreTV.Text.Length > 0)
            {
                genre = genreTV.Text;
            }

            location = null;

            if (locationTV.Text.Length > 0)
            {
                location = locationTV.Text;
            }

            date = null;

            if (dateTV.Text.Length == 10)
            {
                date = dateTV.Text;
            }

            minRating = 0;

            if (minRatingBar.Rating > 0.0)
            {
                minRating = minRatingBar.Rating;
            }

            int minRatingI = (int)Math.Round(minRating, 0);

            minPrice = minPriceSeekBar.Progress;

            maxPrice = 0;

            if (maxPriceSeekBar.Progress > 0)
            {
                maxPrice = maxPriceSeekBar.Progress;
            }

            foundBands = MusicoConnUtil.SearchBandsAsync(location, genre, minPrice, maxPrice, minRatingI, Convert.ToDateTime(date), name);
            foundBands.Sort();

            string[] names   = new string[foundBands.Count];
            float[]  prices  = new float[foundBands.Count];
            float[]  ratings = new float[foundBands.Count];

            int j = foundBands.Count - 1;

            for (int i = 0; i < foundBands.Count; i++)
            {
                names [j]   = foundBands [i].Name;
                prices [j]  = foundBands [i].AvgPrice;
                ratings [j] = foundBands [i].AvgRate;
                j--;
            }

            Intent intent = new Intent(this, typeof(BandListActivity));

            intent.PutExtra("names", names);
            intent.PutExtra("prices", prices);
            intent.PutExtra("ratings", ratings);
            intent.PutExtra("id", userId);
            StartActivity(intent);
        }