Пример #1
0
        public override void ViewDidLoad()
        {
            btnStart.TouchUpInside += async(s, a) => {
                loadingOverlay = new LoadingOverlay(UIScreen.MainScreen.Bounds);
                View.Add(loadingOverlay);
                if (VM is ParticipateLiveVM)
                {
                    var vm = ((ParticipateLiveVM)VM);
                    vm.ChannelName    = txtSurveyCode.Text;
                    vm.User.FirstName = txtFirstName.Text;
                    vm.User.LastName  = txtLastName.Text;
                    var result = await vm.FindSurveyCurrentChannel();

                    loadingOverlay.Hide();
                    if (result == 1)
                    {
                        var controller = (LiveSurveyController)this.Storyboard.InstantiateViewController("LiveSurvey");
                        controller.VM = vm;
                        this.PresentViewController(controller, true, null);
                    }
                    else
                    {
                        var alert = new UIAlertView()
                        {
                            Title   = "Error",
                            Message = vm.ErrorMessage
                        };
                        alert.AddButton("Ok");
                        alert.Show();
                    }
                }
                else
                {
                    var vm = ((ParticipateStaticVM)VM);
                    vm.ChannelName    = txtSurveyCode.Text;
                    vm.User.FirstName = txtFirstName.Text;
                    vm.User.LastName  = txtLastName.Text;
                    var result = await vm.FindSurveyCurrentChannel();

                    loadingOverlay.Hide();
                    if (result == 1)
                    {
                        var controller = (StaticSurveyController)this.Storyboard.InstantiateViewController("StaticSurvey");
                        controller.VM = vm;
                        this.PresentViewController(controller, true, null);
                    }
                    else
                    {
                        var alert = new UIAlertView()
                        {
                            Title   = "Error",
                            Message = vm.ErrorMessage
                        };
                        alert.AddButton("Ok");
                        alert.Show();
                    }
                }
            };
        }
		public override void ViewDidLoad (){

			btnStart.TouchUpInside+= async(s,a)=>{
				loadingOverlay = new LoadingOverlay (UIScreen.MainScreen.Bounds);
				View.Add (loadingOverlay);
				if(VM is ParticipateLiveVM){
					var vm= ((ParticipateLiveVM)VM);
					vm.ChannelName=txtSurveyCode.Text;
					vm.User.FirstName=txtFirstName.Text;
					vm.User.LastName=txtLastName.Text;
					var result = await vm.FindSurveyCurrentChannel();
					loadingOverlay.Hide();
					if(result==1){
						var controller = (LiveSurveyController)this.Storyboard.InstantiateViewController("LiveSurvey");
						controller.VM=vm;
						this.PresentViewController(controller,true,null);
					}
					else{
						var alert = new UIAlertView(){
							Title = "Error",
							Message = vm.ErrorMessage
						};
						alert.AddButton("Ok");
						alert.Show();
					}
				}
				else{
					var vm= ((ParticipateStaticVM)VM);
					vm.ChannelName=txtSurveyCode.Text;
					vm.User.FirstName=txtFirstName.Text;
					vm.User.LastName=txtLastName.Text;
					var result =  await vm.FindSurveyCurrentChannel();
					loadingOverlay.Hide();
					if(result==1){
						var controller = (StaticSurveyController)this.Storyboard.InstantiateViewController("StaticSurvey");
						controller.VM=vm;
						this.PresentViewController(controller,true,null);
					}
					else{
						var alert = new UIAlertView(){
							Title = "Error",
							Message = vm.ErrorMessage
						};
						alert.AddButton("Ok");
						alert.Show();
					}
				}
			};

		}