示例#1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.MyTest);
            activity        = this;
            SerilizeString  = Intent.GetStringExtra("serilizeObj");
            objPackageMOdel = JsonConvert.DeserializeObject <UserPackageModel>(SerilizeString);
            Utility.intalizejson();
            txtOnlinetest = FindViewById <TextView>(Resource.Id.tabonlinetest);
            txtMockTest   = FindViewById <TextView>(Resource.Id.tabmocktest);
            toolbar       = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            //For showing back button
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            toolbar.SetTitle(Resource.String.MyRequest);
            //SupportFragmentManager.BeginTransaction().Replace(Resource.Id.testlistfragment,new DoOnlineTestFragment()).Commit();

            txtOnlinetest.SetOnClickListener(this);
            txtMockTest.SetOnClickListener(this);

            cp = new CustomProgressDialog(this);
            cp.Show();

            if (Utility.IsNetworkConnected(this))
            {
                Callapi();
            }
            else
            {
                cp.Dismiss();
                Toast.MakeText(this, "Check your internet connection", ToastLength.Short).Show();
            }
        }
        async void FetchSumaryFromServer(int testid)
        {
            CustomProgressDialog cpd = new CustomProgressDialog(Activity);

            cpd.SetCancelable(false);
            cpd.Show();
            var apiresponse        = RestService.For <ApiConnectionForTestPackage>(Utility.stapibaseUrl);
            var responseforsummary = await apiresponse.GetTestSummary(MainActivity1.userid + "", testid + "");

            List <TestSummaryDataModel> summarylist = JsonConvert.DeserializeObject <List <TestSummaryDataModel> >(responseforsummary.Data);

            cpd.DismissDialog();
            var intent = new Intent(Activity, typeof(TestSummary));

            intent.PutExtra("path", "portal");
            intent.PutExtra("testsummarylist", responseforsummary.Data);
            Activity.StartActivityForResult(intent, 102);
            Activity.OverridePendingTransition(Resource.Animation.slide_left, Resource.Animation.hold);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.TestInstruction);
            activity    = this;
            Spnlanguage = FindViewById <Spinner>(Resource.Id.testlanguage);


            txtnoofquestion = FindViewById <TextView>(Resource.Id.noofquestion);
            txttime         = FindViewById <TextView>(Resource.Id.questiontime);
            txttotalmarks   = FindViewById <TextView>(Resource.Id.totalmarks);
            txtTestname     = FindViewById <TextView>(Resource.Id.testname);
            Testid          = Intent.GetIntExtra("TestID", 0);
            testduration    = Intent.GetIntExtra("TestDuration", 0);
            testtype        = Intent.GetStringExtra("testtype");
            string testname = Intent.GetStringExtra("TestName");

            txtTestname.Text = testname;
            StartTest        = FindViewById <Button>(Resource.Id.startest);
            StartTest.StartAnimation(AnimationUtils.LoadAnimation(this, Resource.Animation.shake));
            StartTest.SetOnClickListener(this);
            toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            //For showing back button
            //SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            //SupportActionBar.SetHomeButtonEnabled(true);
            toolbar.SetTitle(Resource.String.MyRequest);
            cp = new CustomProgressDialog(this);
            cp.Show();
            if (Utility.IsNetworkConnected(this))
            {
                CallApi();
            }
            else
            {
                cp.Dismiss();
                Toast.MakeText(this, "Check your internet connection", ToastLength.Short).Show();
            }
        }
示例#4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            RequestWindowFeature((int)WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.CustomDialog);
            this.Window.Attributes.WindowAnimations = Resource.Style.DialogAnimation;
            TextView cancel           = (TextView)FindViewById(Resource.Id.button_cancel);
            TextView submit           = (TextView)FindViewById(Resource.Id.submit_button);
            TextView txtanswer        = (TextView)FindViewById(Resource.Id.answered);
            TextView txtmarkforreview = (TextView)FindViewById(Resource.Id.markforreview);
            TextView txtunseen        = (TextView)FindViewById(Resource.Id.unseenquestion);
            TextView txtunanswered    = (TextView)FindViewById(Resource.Id.unanswered);
            TextView txtTitle         = (TextView)FindViewById(Resource.Id.dialogTitle);

            //======================if popup open fron timeup==========================//
            if (cancelshowornot)
            {
                cancel.Visibility = ViewStates.Visible;
            }
            else
            {
                cancel.Visibility = ViewStates.Invisible;
                txtTitle.Text     = "Time Up";
            }

            //=========================================================================//
            txtanswer.Text        = answeredquestion + "";
            txtmarkforreview.Text = markforreview + "";
            txtunseen.Text        = unseenquestion + "";
            txtunanswered.Text    = unanswered + "";

            submit.Click += (e, a) =>
            {
                Dismiss();
                List <UserResponse> myuserresponselist = new List <UserResponse>();
                for (int i = 0; i < AllTestList.Count(); i++)
                {
                    List <questionmodel> questionlist = AllTestList[i];
                    for (int y = 0; y < questionlist.Count; y++)
                    {
                        questionmodel objmodel = questionlist[y];

                        if (objmodel.Datatype == 1)
                        {
                            bool  iscoorect       = false;
                            bool  ismarkforreview = false;
                            float marks           = 0;
                            if (objmodel.colorcode != Resource.Drawable.whitecircle1)
                            {
                                if (objmodel.rightorwrongColorCode == Resource.Drawable.greenCircle)
                                {
                                    iscoorect = true;
                                    marks     = objmodel.Correctmarks;
                                    if (objmodel.markforreview == 0)
                                    {
                                        ismarkforreview = false;
                                    }
                                    else
                                    {
                                        ismarkforreview = true;
                                    }
                                }
                                else if (objmodel.rightorwrongColorCode == Resource.Drawable.redcircle)
                                {
                                    iscoorect = false;
                                    marks     = negativemarks * -1;
                                    if (objmodel.markforreview == 0)
                                    {
                                        ismarkforreview = false;
                                    }
                                    else
                                    {
                                        ismarkforreview = true;
                                    }
                                }

                                if (objmodel.colorcode == Resource.Drawable.redcircle)
                                {
                                    iscoorect = false;
                                    marks     = 0;
                                    if (objmodel.markforreview == 0)
                                    {
                                        ismarkforreview = false;
                                    }
                                    else
                                    {
                                        ismarkforreview = true;
                                    }
                                }

                                String       date         = "01/05/2019";
                                DateTime     oDate        = Convert.ToDateTime(date);
                                UserResponse userresponse = new UserResponse
                                {
                                    ID            = objmodel.Id,
                                    TestID        = testid,
                                    QID           = objmodel.Qid,
                                    UserID        = MainActivity1.userid,
                                    TimeTaken     = 5,
                                    IsCorrect     = iscoorect,
                                    Marks         = marks,
                                    MarkForReview = ismarkforreview,
                                    Response      = objmodel.selectedoption + "",
                                };
                                myuserresponselist.Add(userresponse);
                            }
                            break;
                        }
                        else
                        {
                            continue;
                        }
                    }
                }

                SubmitTestData sdata = new SubmitTestData
                {
                    TestID           = testid,
                    userid           = MainActivity1.userid,
                    deflanguage      = langcode,
                    UserResponseData = myuserresponselist
                };

                CustomProgressDialog cp = new CustomProgressDialog(context);

                cp.Show();
                if (Utility.IsNetworkConnected(context))
                {
                    Callapi(sdata, cp);
                }
                else
                {
                    cp.Dismiss();
                    Toast.MakeText(context, "Check your internet connection", ToastLength.Short).Show();
                }
            };
            cancel.Click += (e, a) =>
            {
                Dismiss();
                if (submitoncancel)
                {
                    context.Finish();
                }
            };
        }
示例#5
0
 protected override void OnPreExecute()
 {
     cp.Show();
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.TestSelection);
            pref   = GetSharedPreferences("login", FileCreationMode.Private);
            edit   = pref.Edit();
            banned = pref.GetBoolean("banned", false);


            //if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.WriteExternalStorage) != (int)Permission.Granted)
            //{
            //    if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.WriteExternalStorage))
            //    {

            //    }
            //    else
            //    {
            //        ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.WriteExternalStorage }, 101);
            //    }
            //}
            //if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) != (int)Permission.Granted)
            //{
            //    if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.ReadExternalStorage))
            //    {

            //    }
            //    else
            //    {
            //        ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.ReadExternalStorage }, 102);
            //    }
            //}


            Utility.intalizejson();
            JsonConvert.DefaultSettings = () => new JsonSerializerSettings()
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver(),
                Converters       = { new StringEnumConverter() }
            };

            toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            //For showing back button
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            toolbar.SetTitle(Resource.String.MyRequest);
            mRecycleView   = FindViewById <RecyclerView>(Resource.Id.mytestselectionlist);
            mLayoutManager = new GridLayoutManager(this, 3);
            mRecycleView.SetLayoutManager(mLayoutManager);
            cp = new CustomProgressDialog(this);
            cp.SetCancelable(false);
            cp.Show();

            if (Utility.IsNetworkConnected(this))
            {
                Callapi();
            }
            else
            {
                cp.Dismiss();
                Toast.MakeText(this, "Check your internet connection", ToastLength.Short).Show();
            }

            if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.WriteExternalStorage) != (int)Permission.Granted)
            {
                if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.WriteExternalStorage))
                {
                }
                else
                {
                    ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.WriteExternalStorage }, 101);
                }
            }
            if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) != (int)Permission.Granted)
            {
                if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.ReadExternalStorage))
                {
                }
                else
                {
                    ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.ReadExternalStorage }, 102);
                }
            }

            // Create your application here
        }