Ejemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.StaticSurvey);
            this.SetOrientationBackground(Resource.Id.StaticSurvey);
            VM = (ParticipateStaticVM)AppModel.VM;
            layout = FindViewById<LinearLayout>(Resource.Id.optionLayout);
            btnNext = FindViewById<Button>(Resource.Id.btnNext);
            btnBack = FindViewById<Button>(Resource.Id.btnBack);
            btnQuit = FindViewById<Button>(Resource.Id.btnQuit);
            btnNext.Click += (e, a) =>
            {
                ClearComponents();
                VM.NextQuestion();
                InitComponents();
            };
            btnBack.Click += (e, a) =>
            {
                ClearComponents();
                VM.BackQuestion();
                InitComponents();
            };
            btnQuit.Click += (e, a) =>
            {
                
                var builder1 = new AlertDialog.Builder(new ContextThemeWrapper(this, Resource.Style.AlertDialogCustom));
                builder1.SetTitle("Exiting...");
                builder1.SetMessage("Do you want to save your changes");
                builder1.SetPositiveButton("Yes", async delegate
                {
                    ShowLoading();
                    var result = await VM.SaveSurveyResponses();
                    this.progress.Dismiss();
                    ClearComponents();
                    this.Finish();
                    StartActivity(typeof(Home));
                });
                builder1.SetNegativeButton("No", delegate {
                    ClearComponents();
                    this.Finish();
                    StartActivity(typeof(Home));
                });
                builder1.SetNeutralButton("Cancel", delegate {
                    
                });
                var alert1 = builder1.Show();
                ChangeDialogColor(alert1);
                


            };
            InitComponents();      
        }
Ejemplo n.º 2
0
 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     btnLive.TouchUpInside += (s, a) => {
         var vm           = new ParticipateLiveVM();
         var selectSurvey = (SelectSurveyController)this.Storyboard.InstantiateViewController("SelectSurvey");
         selectSurvey.VM = vm;
         this.PresentViewController(selectSurvey, true, null);
     };
     btnStatic.TouchUpInside += (s, a) => {
         var vm           = new ParticipateStaticVM();
         var selectSurvey = (SelectSurveyController)this.Storyboard.InstantiateViewController("SelectSurvey");
         selectSurvey.VM = vm;
         this.PresentViewController(selectSurvey, true, null);
     };
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="navigationParameter">The parameter value passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
 /// </param>
 /// <param name="pageState">A dictionary of state preserved by this page during an earlier
 /// session.  This will be null the first time a page is visited.</param>
 protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
 {
     VM = (ParticipateStaticVM)navigationParameter;
 }
Ejemplo n.º 4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.SelectSurvey);
            this.SetOrientationBackground(Resource.Id.SelectFrame);

            var btnStart      = FindViewById <Button>(Resource.Id.btnStart);
            var txtFirstName  = FindViewById <TextView>(Resource.Id.txtFirstName);
            var txtlastName   = FindViewById <TextView>(Resource.Id.txtLastName);
            var txtSurveyCode = FindViewById <TextView>(Resource.Id.txtSurveyCode);

            btnStart.Click += async(e, a) =>
            {
                try
                {
                    switch (Intent.GetStringExtra("VM"))
                    {
                    case "ParticipateLiveVM":
                        ShowLoading();
                        var lvm = new ParticipateLiveVM();
                        lvm.User.FirstName = txtFirstName.Text;
                        lvm.User.LastName  = txtlastName.Text;
                        lvm.ChannelName    = txtSurveyCode.Text;
                        var lr = await lvm.FindSurveyCurrentChannel();

                        progress.Dismiss();
                        if (lr == 1)
                        {
                            AppModel.VM = lvm;
                            StartActivity(typeof(LiveSurveyActivity));
                        }
                        else
                        {
                            var builder1 = new AlertDialog.Builder(new ContextThemeWrapper(this, Resource.Style.AlertDialogCustom));
                            builder1.SetTitle("Oops, somethings wrong");
                            builder1.SetMessage(lvm.ErrorMessage);
                            builder1.SetPositiveButton("OK", delegate { });
                            var alert1 = builder1.Show();
                            ChangeDialogColor(alert1);
                        }
                        break;

                    case "ParticipateStaticVM":
                        ShowLoading();
                        var svm = new ParticipateStaticVM();
                        svm.User.FirstName = txtFirstName.Text;
                        svm.User.LastName  = txtlastName.Text;
                        svm.ChannelName    = txtSurveyCode.Text;
                        var sr = await svm.FindSurveyCurrentChannel();

                        progress.Dismiss();
                        if (sr == 1)
                        {
                            AppModel.VM = svm;
                            StartActivity(typeof(StaticSurveyActivity));
                        }
                        else
                        {
                            var builder2 = new AlertDialog.Builder(new ContextThemeWrapper(this, Resource.Style.AlertDialogCustom));
                            builder2.SetTitle("Oops, somethings wrong");
                            builder2.SetMessage(svm.ErrorMessage);
                            builder2.SetPositiveButton("OK", delegate { });
                            var alert2 = builder2.Show();
                            ChangeDialogColor(alert2);
                        }
                        break;
                    }
                }
                catch (Exception ex)
                {
                    var builder1 = new AlertDialog.Builder(new ContextThemeWrapper(this, Resource.Style.AlertDialogCustom));
                    builder1.SetTitle("Error...");
                    builder1.SetMessage(ex.Message);
                    builder1.SetPositiveButton("Ok", delegate
                    {
                    });
                    var alert1 = builder1.Show();
                    ChangeDialogColor(alert1);
                }
            };
        }