예제 #1
0
            void SektorleriGetir()
            {
                WebService webService = new WebService();
                var        Donus      = webService.OkuGetir("sectors");

                if (Donus != null)
                {
                    SektorList = Newtonsoft.Json.JsonConvert.DeserializeObject <List <StringDTO> >(Donus.ToString());
                    if (SektorList.Count > 0)
                    {
                        this.Activity.RunOnUiThread(delegate
                        {
                            mViewAdapter = new StringRecyclerViewAdapter(SektorList, (Android.Support.V7.App.AppCompatActivity) this.Activity);
                            mRecyclerView.HasFixedSize = true;
                            mLayoutManager             = new LinearLayoutManager(this.Activity);
                            mRecyclerView.SetLayoutManager(mLayoutManager);
                            mRecyclerView.SetAdapter(mViewAdapter);
                            mViewAdapter.ItemClick += MViewAdapter_ItemClick;
                        });
                    }
                    else
                    {
                        this.Activity.RunOnUiThread(delegate
                        {
                            Toast.MakeText(this.Activity, "Sektörler alınamadı lütfen tekrar deneyin.", ToastLength.Long).Show();
                            return;
                        });
                    }
                }
                else
                {
                    this.Activity.RunOnUiThread(delegate
                    {
                        Toast.MakeText(this.Activity, "Sektörler alınamadı lütfen tekrar deneyin.", ToastLength.Long).Show();
                        return;
                    });
                }
            }
예제 #2
0
 public void HizmetleriGetir(string SektorID)
 {
     if (string.IsNullOrEmpty(SektorID))
     {
         WebService webService = new WebService();
         var        Donus      = webService.OkuGetir("service-areas");
         if (Donus != null)
         {
             HizmetList_Hepsi = Newtonsoft.Json.JsonConvert.DeserializeObject <List <StringDTO> >(Donus.ToString());
             //if (HizmetList_Hepsi.Count > 0)
             //{
             //    this.Activity.RunOnUiThread(delegate
             //    {
             //        mViewAdapter = new StringRecyclerViewAdapter(HizmetList_Hepsi, (Android.Support.V7.App.AppCompatActivity)this.Activity);
             //        mRecyclerView.HasFixedSize = true;
             //        mLayoutManager = new LinearLayoutManager(this.Activity);
             //        mRecyclerView.SetLayoutManager(mLayoutManager);
             //        mRecyclerView.SetAdapter(mViewAdapter);
             //        mViewAdapter.ItemClick += MViewAdapter_ItemClick;
             //    });
             //}
             //else
             //{
             //    this.Activity.RunOnUiThread(delegate
             //    {
             //        Toast.MakeText(this.Activity, "Hizmetler alınamadı lütfen tekrar deneyin.", ToastLength.Long).Show();
             //        return;
             //    });
             //}
         }
         else
         {
             this.Activity.RunOnUiThread(delegate
             {
                 Toast.MakeText(this.Activity, "Hizmetler alınamadı lütfen tekrar deneyin.", ToastLength.Long).Show();
                 return;
             });
         }
     }
     else
     {
         if (HizmetList_Hepsi.Count > 0)
         {
             HizmetList = HizmetList_Hepsi.FindAll(item => item.sectorId == SektorID);
             this.Activity.RunOnUiThread(delegate()
             {
                 if (HizmetList.Count > 0)
                 {
                     if (mViewAdapter != null)
                     {
                         if (mViewAdapter.mData.Count > 0)
                         {
                             mViewAdapter.mData = HizmetList;
                             mViewAdapter.NotifyDataSetChanged();
                         }
                     }
                     else
                     {
                         mViewAdapter = new StringRecyclerViewAdapter(HizmetList, (Android.Support.V7.App.AppCompatActivity) this.Activity);
                         mRecyclerView.HasFixedSize = true;
                         mLayoutManager             = new LinearLayoutManager(this.Activity);
                         mRecyclerView.SetLayoutManager(mLayoutManager);
                         mRecyclerView.SetAdapter(mViewAdapter);
                         mViewAdapter.ItemClick -= MViewAdapter_ItemClick;
                         mViewAdapter.ItemClick += MViewAdapter_ItemClick;
                     }
                     IsletmeProfiliBaseActivity1.viewpager.SetCurrentItem(IsletmeProfiliBaseActivity1.viewpager.CurrentItem + 1, true);
                 }
                 else
                 {
                     mViewAdapter = null;
                     mRecyclerView.SetAdapter(mViewAdapter);
                     mRecyclerView.HasFixedSize = true;
                 }
             });
         }
         else
         {
             this.Activity.RunOnUiThread(delegate
             {
                 Toast.MakeText(this.Activity, "Hizmetler alınamadı lütfen tekrar deneyin.", ToastLength.Long).Show();
                 return;
             });
         }
     }
 }