Problem WebService, help !!!

Hello guys, all right ! ...
Well, come on .

I started developing an application . Net, 'm consuming webservice service my company .

Well I have an activity that logs in through my method LoginAsync ( )
after I login , it should call the activity Home.cs this aggregated Home.axml

so that ai .. this problem : just look at the code :

Home.cs :

private static app _webService ;
        private static TextView student;

        protected override void OnCreate ( Bundle bundle )
        {
            try
            {
                _webService app = new ( ) ;

                base.OnCreate (bundle ) ;

                / / Create your application here
                SetContentView ( Resource.Layout.Home ) ;

                _webService.LoginCompleted + = _webService_LoginCompleted ;
            }
            catch (Exception e1 )
            {

                var msg = new AlertDialog.Builder (this) ;
                msg.SetMessage ( e1.Message );
                msg.Show ();
            }

        }

        _webService_LoginCompleted void ( object sender , LoginCompletedEventArgs e)
        {
            try
            {
                var = new converter converter ();
                dadosAluno conversor.ConvertJson = var ( e.Result );

                student = findViewById ( Resource.Id.lblNomeAluno ) ;

                aluno.Text = Intent.GetStringExtra ( " Student" ) ? dadosAluno.NomeAluno ;
            }
            catch (Exception e2 )
            {
                var msg = new AlertDialog.Builder (this) ;
                msg.SetMessage ( e2.Message );
                msg.Show ();
            }

        }
    }
}


Login.cs :

 private static app _webService ;

        private static Button btnConectar ;
        private static EditText txtRm ;
        private static EditText txtSenha ;

        protected override void OnCreate ( Bundle bundle )
        {

            _webService app = new ( ) ;

            base.OnCreate (bundle ) ;

            SetContentView ( Resource.Layout.Login ) ;

            btnConectar = findViewById ( Resource.Id.btnConectar ) ;
            txtRm = findViewById ( Resource.Id.txtRm ) ;
            txtSenha = findViewById ( Resource.Id.txtSenha ) ;

            btnConectar.Click + = delegate
                {
                    try
                    {
                        _webService.LoginAsync ( txtRm.Text , txtSenha.Text , " XXXX - XXXX - XXXXX - XXXXX - XXXX " , " 1 " ) ;
                        _webService.LoginCompleted + = _webService_LoginCompleted ;

                    }
                    catch ( Exception ex )
                    {
                        var msg = new AlertDialog.Builder (this) ;
                        msg.SetMessage ( ex.Message ) ;
                        msg.Show ();
                    }
                } ;
        }

        private void _webService_LoginCompleted ( object sender , LoginCompletedEventArgs e)
        {
            try
            {
                var = new converter converter ();
                dadosAluno conversor.ConvertJson = var ( e.Result );

                var home = new Intent (this, typeof ( Home) ) ;
                home.PutExtra ( " Student" , " Hello , " + dadosAluno.NomeAluno ) ;
                StartActivity ( home ) ;
            }
            catch (Exception e2 )
            {
                var msg = new AlertDialog.Builder (this) ;
                msg.SetMessage ( e2.Message );
                msg.Show ();
            }

        }

    }
}

This ae, can someone help me ?

Sign In or Register to comment.