예제 #1
0
 protected override void OnPostExecute(string result)
 {
     //Thread.Sleep(1000);
     unzip();
     myinteface.callback();
     cp.Dismiss();
 }
예제 #2
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();
            }
        }
예제 #3
0
        async void Callapi(SubmitTestData sdata, CustomProgressDialog cp)
        {
            string test = JsonConvert.SerializeObject(sdata);

            Console.WriteLine("deepanshu-->" + test);
            try
            {
                var    apiresponse = RestService.For <ApiConnectionForTestPackage>(Utility.stapibaseUrl);
                string response    = await apiresponse.SubmitTestRecord(sdata);

                // edit.Clear();
                //edit.Apply();



                if (testtype.Equals("online"))
                {
                    FetchSumaryFromServer(testid, cp);
                    //var intent = new Intent(context, typeof(TestSummary));
                    //// intent.PutExtra("question", question);
                    //// intent.PutExtra("passage", passage);
                    //edit.PutString("path", path);
                    //edit.PutString("item", item);
                    //edit.PutString("startingquestionposition", JsonConvert.SerializeObject(startingquestionposition));

                    //edit.Apply();
                    //intent.PutExtra("path", path);
                    //intent.PutExtra("item", item);
                    //intent.PutExtra("startingquestionposition", JsonConvert.SerializeObject(startingquestionposition));
                    //context.StartActivityForResult(intent, 101);
                    //context.OverridePendingTransition(Resource.Animation.slide_left, Resource.Animation.hold);
                }
                else
                {
                    var intent = new Intent(context, typeof(Solution));
                    allquestion = question;
                    //intent.PutExtra("question", question);
                    intent.PutExtra("passage", passage);
                    intent.PutExtra("path", path);
                    // intent.PutExtra("item", item);
                    //intent.PutExtra("startingquestionposition", JsonConvert.SerializeObject(startingquestionposition));
                    context.StartActivityForResult(intent, 101);
                    context.OverridePendingTransition(Resource.Animation.slide_left, Resource.Animation.hold);
                }
            }
            catch (Exception)
            {
                cp.Dismiss();
                Dismiss();
                Toast.MakeText(context, "Test schedule is over", ToastLength.Long).Show();
            }
        }
예제 #4
0
        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();
            }
        }
예제 #5
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();
                }
            };
        }
예제 #6
0
        async void CallApi()
        {
            var testInfoApi      = RestService.For <ApiConnectionForTestPackage>(Utility.stapibaseUrl);
            var testInfoResponse = await testInfoApi.GetSTInfo(Testid + "");

            testDataRecord = JsonConvert.DeserializeObject <TestDataRecord>(testInfoResponse.Data);
            string language = testDataRecord.Languages;

            string[] languacodearray = language.Split(",");
            for (int i = 0; i < languacodearray.Count(); i++)
            {
                languagecodelist.Add(languacodearray[i]);
                languagelist.Add(languacodearray[i].ToUpper());
            }
            var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, languagelist);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            Spnlanguage.Adapter       = adapter;
            Spnlanguage.ItemSelected += Spnlanguage_ItemSelected;
            try
            {
                testInfoList = testDataRecord.SubPattern;
            }
            catch (Exception)
            {
                Intent resultIntent = new Intent();
                resultIntent.PutExtra("serilizeObj", MyTest.SerilizeString);
                resultIntent.PutExtra("testtype", testtype);
                SetResult(Result.Ok, resultIntent);

                Finish();
                //MyTest.activity.Finish();
                //var intent1 = new Intent(this, typeof(MyTest));
                //intent1.PutExtra("serilizeObj", MyTest.SerilizeString);
                //StartActivity(intent1);
                OverridePendingTransition(Resource.Animation.hold, Resource.Animation.slide_right);
                return;
            }


            startingquestionposition.Add(mycounter);
            testInfoList.Sort((x, y) => x.SeqNo.CompareTo(y.SeqNo));
            for (int i = 0; i < testInfoList.Count; i++)
            {
                testInfoList[i].Duration = testInfoList[i].Duration * 60 * 1000;
                //testInfoList[i].Duration = 20 * 1000;

                if (i != 0)
                {
                    mycounter = mycounter + testInfoList[i - 1].TotalQuestion;
                    startingquestionposition.Add(mycounter);
                }
                items.Add(testInfoList[i].SubjectTitle);
                subjectid.Add(testInfoList[i].SubjectID);
                subjecttotalquestion.Add(testInfoList[i].TotalQuestion);
            }
            //  txtlanguage.Text = testDataRecord.Languages;
            txtnoofquestion.Text = testDataRecord.TotalQuestions + "";
            txttime.Text         = testDataRecord.Duration + "";
            txttotalmarks.Text   = testDataRecord.TotalMarks + "";
            mRecycleView         = FindViewById <RecyclerView>(Resource.Id.sectionalpatternlist);
            mLayoutManager       = new LinearLayoutManager(this);
            mRecycleView.SetLayoutManager(mLayoutManager);
            TestInstructionAdapter mAdapter = new TestInstructionAdapter(this, mRecycleView, testInfoList);

            mRecycleView.SetAdapter(mAdapter);
            cp.Dismiss();
        }
예제 #7
0
        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
        }
예제 #8
0
        public void PrepareRecord()
        {
            //================================remove those test which not belonged to loogedin user=============//
            MyFinalTestList = new List <AllTestModelData>();
            for (int i = 0; i < AllTestlist.Count; i++)
            {
                if (AllTestlist[i].Packages.Equals(packageid))
                {
                    MyFinalTestList.Add(AllTestlist[i]);
                }
                else
                {
                    string[] pacjagearray = AllTestlist[i].Packages.Split(",");
                    for (int y = 0; y < pacjagearray.Length; y++)
                    {
                        if (packageid.Equals(pacjagearray[y]))
                        {
                            MyFinalTestList.Add(AllTestlist[i]);
                            break;
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
            }
            MyFinalTestListMock = new List <AllTestModelData>();
            for (int i = 0; i < AllTestlistMock.Count; i++)
            {
                if (AllTestlistMock[i].Packages.Equals(packageidMock))
                {
                    MyFinalTestListMock.Add(AllTestlistMock[i]);
                }
                else
                {
                    string[] pacjagearray = AllTestlistMock[i].Packages.Split(",");
                    for (int y = 0; y < pacjagearray.Length; y++)
                    {
                        if (packageidMock.Equals(pacjagearray[y]))
                        {
                            MyFinalTestListMock.Add(AllTestlistMock[i]);
                            break;
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
            }


            List <AllTestModelData> GivenExamTest      = new List <AllTestModelData>();
            List <AllTestModelData> GivenPracticalTest = new List <AllTestModelData>();

            try
            {
                for (int i = 0; i < GivenTestlist.Count; i++)
                {
                    if (GivenTestlist[i].TestType.Equals("Exam"))
                    {
                        GivenExamTest.Add(GivenTestlist[i]);
                    }
                    else
                    {
                        GivenPracticalTest.Add(GivenTestlist[i]);
                    }
                }
            }
            catch (Exception)
            {
            }

            for (int i = 0; i < MyFinalTestList.Count; i++)
            {
                ISharedPreferences       pref;
                ISharedPreferencesEditor edit;
                pref = GetSharedPreferences(MyFinalTestList[i].ID + "", FileCreationMode.Private);
                edit = pref.Edit();
                string question = pref.GetString("TestRecord", String.Empty);
                if (question.Length > 0)
                {
                    MyFinalTestList[i].Text       = "Resume";
                    MyFinalTestList[i].background = Resource.Drawable.greenRectangle;
                }
                else
                {
                    MyFinalTestList[i].Text       = "Start Test";
                    MyFinalTestList[i].background = Resource.Drawable.mytestTextview;
                }
                for (int y = 0; y < GivenExamTest.Count; y++)
                {
                    if (MyFinalTestList[i].ID == GivenExamTest[y].TestID)
                    {
                        MyFinalTestList[i].Text       = "Taken";
                        MyFinalTestList[i].background = Resource.Drawable.myorangetextview;
                    }

                    else
                    {
                        continue;
                    }
                }
            }

            for (int i = 0; i < MyFinalTestListMock.Count; i++)
            {
                ISharedPreferences       pref;
                ISharedPreferencesEditor edit;
                pref = GetSharedPreferences(MyFinalTestListMock[i].ID + "", FileCreationMode.Private);
                edit = pref.Edit();
                string question = pref.GetString("TestRecord", String.Empty);
                if (question.Length > 0)
                {
                    MyFinalTestListMock[i].Text       = "Resume";
                    MyFinalTestListMock[i].background = Resource.Drawable.greenRectangle;
                }
                else
                {
                    MyFinalTestListMock[i].Text       = "Start Test";
                    MyFinalTestListMock[i].background = Resource.Drawable.mytestTextview;
                }
                for (int y = 0; y < GivenPracticalTest.Count; y++)
                {
                    if (MyFinalTestListMock[i].ID == GivenPracticalTest[y].TestID)
                    {
                        MyFinalTestListMock[i].Text       = "Taken";
                        MyFinalTestListMock[i].background = Resource.Drawable.myorangetextview;
                    }

                    else
                    {
                        continue;
                    }
                }
            }

            //===================================================================================================//
            txtOnlinetest.SetBackgroundResource(Resource.Drawable.TabOnlineTextviewSelect);
            txtOnlinetest.SetTextColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.white)));

            txtMockTest.SetBackgroundResource(Resource.Drawable.TabMockTextviewUnselect);
            txtMockTest.SetTextColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.black)));

            myFinalTestlistserilize     = JsonConvert.SerializeObject(MyFinalTestList);
            myFinalMOckTestlistserilize = JsonConvert.SerializeObject(MyFinalTestListMock);
            cp.Dismiss();
            DoOnlineTestFragment obj = new DoOnlineTestFragment();
            Bundle bundle            = new Bundle();

            // bundle.PutString("AllTestList", myFinalTestlistserilize);
            obj.Arguments = bundle;
            SupportFragmentManager.BeginTransaction().Replace(Resource.Id.testlistfragment, obj).Commit();
            //==================================================================================================//
        }