Ejemplo n.º 1
0
        private async void getAboutExam()
        {
            progress.Show();

            try
            {
                ApiResponse response = await aboutapi.GetAboutExamList();

                aboutexamDictinary = response.items;

                Dictionary <string, AboutExamData> .KeyCollection keys = aboutexamDictinary.Keys;


                myFinalList = new List <AboutExamData>();
                foreach (string key in keys)
                {
                    myFinalList.Add(aboutexamDictinary.GetValueOrDefault(key));

                    aboutExamCoursename.Add(aboutexamDictinary.GetValueOrDefault(key).id);
                    aboutExamCoursename.Add(aboutexamDictinary.GetValueOrDefault(key).name);

                    A_Exam_ID = aboutexamDictinary.GetValueOrDefault(key).id;

                    A_Exam_Name = aboutexamDictinary.GetValueOrDefault(key).name;

                    dba.insertAboutExamData(A_Exam_ID, A_Exam_Name);
                }



                ISharedPreferencesEditor edit = pref.Edit();
                edit.PutString("FinalAboutExam", "true");

                edit.Apply();
                //  Toast.MakeText(this.Activity, "-->" + myFinalList[0].name,ToastLength.Short).Show();


                //  MyList.Adapter = new ArrayAdapter(Activity, Android.Resource.Layout.SimpleListItem1, aboutExamCoursename);

                AboutExamGridAdapter videoLecture = new AboutExamGridAdapter(Activity, myFinalList);

                aboutgrid.Adapter = videoLecture;

                progress.Dismiss();
            }
            catch (Exception e)
            {
            }
        }
Ejemplo n.º 2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            //  View v = inflater.Inflate(Resource.Layout.AboutExam_Layout, container, false);
            //  MyList = v.FindViewById<ListView>(Resource.Id.listView);


            View v = inflater.Inflate(Resource.Layout.AboutExam_GridLayout, container, false);



            aboutgrid = v.FindViewById <GridView>(Resource.Id.gridview_aboutexam);

            //==================================Fetch api==========================//
            JsonConvert.DefaultSettings = () => new JsonSerializerSettings()
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver(),
                Converters       = { new StringEnumConverter() }
            };
            // String apiurl = string.Format("http://mg.mahendras.org);
            aboutapi = RestService.For <AboutExamAPI>("http://mg.mahendras.org");

            //=====================================================================//


            if (Abour_Exam.Equals("false"))
            {
                getAboutExam();
            }
            else
            {
                //getAboutExam();

                myFinalList = dba.Get_AboutExamData();

                AboutExamGridAdapter videoLecture = new AboutExamGridAdapter(Activity, myFinalList);

                aboutgrid.Adapter = videoLecture;
            }

            return(v);
        }