protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.layout_register); var btnSave = FindViewById <Button> (Resource.Id.btnGuardar); var txtNombre = FindViewById <TextView> (Resource.Id.txtNombreCompleto); var txtEmail = FindViewById <TextView> (Resource.Id.txtEmailRegistro); var txtPassword = FindViewById <TextView> (Resource.Id.txtContraseña); var txtPassConfirm = FindViewById <TextView> (Resource.Id.txtContraseñaConfirmar); var IniciarSesion = FindViewById <TextView> (Resource.Id.txtIniciarSesion); Typeface font = Typeface.CreateFromAsset(Application.Context.Assets, "Fonts/HelveticaNeue-Thin.otf"); _supporttoolbar = FindViewById <Android.Support.V7.Widget.Toolbar> (Resource.Id.ToolBarRegistro); var ToolbarTitle = FindViewById <TextView> (Resource.Id.toolbar_titleRegister); ToolbarTitle.SetText(Resource.String.Registro); //_supporttoolbar.SetTitle(Resource.String.Registro); SetSupportActionBar(_supporttoolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(false); btnSave.SetTypeface(font, TypefaceStyle.Normal); _supporttoolbar.Click += (object sender, EventArgs e) => { StartActivity(typeof(MainActivity)); }; IniciarSesion.Click += (object sender, EventArgs e) => { StartActivity(typeof(IniciarSesionActivity)); }; btnSave.Click += (object sender, EventArgs e) => { btnSave.SetBackgroundColor(Color.White); btnSave.SetTextColor(Color.Orange); string strNombre = txtNombre.Text.Trim(); string strEmail = txtEmail.Text.Trim(); string strPassword = txtPassword.Text.Trim(); string strPassConfirm = txtPassConfirm.Text.Trim(); string string_key = "41f579fc-1445-4065-ab10-c06d50e724d3"; services_911consumidor_com.COCOService cliente = new Navigation_View.services_911consumidor_com.COCOService(); cliente.AccountRegistration(new Navigation_View.services_911consumidor_com.UserDTO { FirstName = strNombre, Email = strEmail, Password = strPassword, Device = string.Empty }, string_key); Xamarin.Auth.Account account = new Xamarin.Auth.Account(strEmail, AccountCore.Dictionary(strNombre, strEmail, strPassword)); AccountStore.Create(this).Save(account, "consumidor"); new Android.Support.V7.App.AlertDialog.Builder(this) .SetMessage("Su cuenta ha sido registrada.") .SetTitle("ATENCIÓN") .Show(); StartActivity(typeof(MainActivity)); }; // Create your application here }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.layout_iniciar_sesion); Typeface font = Typeface.CreateFromAsset(Application.Context.Assets, "Fonts/HelveticaNeue-Thin.otf"); var btnIniciar = FindViewById <Button> (Resource.Id.btnIniciar); var txtContraseña = FindViewById <TextView> (Resource.Id.txtContraseñaSesion); var txtEmail = FindViewById <TextView> (Resource.Id.txtEmailSesion); btnIniciar.SetTypeface(font, TypefaceStyle.Normal); _supporttoolbar = FindViewById <Android.Support.V7.Widget.Toolbar> (Resource.Id.ToolBarSesion); var ToolbarTitle = FindViewById <TextView> (Resource.Id.toolbar_sesion); ToolbarTitle.SetText(Resource.String.Sesion); SetSupportActionBar(_supporttoolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(false); btnIniciar.Click += (object sender, EventArgs e) => { btnIniciar.SetBackgroundColor(Color.White); btnIniciar.SetTextColor(Color.Orange); string string_key = "41f579fc-1445-4065-ab10-c06d50e724d3"; string UserEmail = txtEmail.Text.Trim(); string Password = txtContraseña.Text.Trim(); try { services_911consumidor_com.COCOService cliente = new Navigation_View.services_911consumidor_com.COCOService(); services_911consumidor_com.UserDTO Usuario = new Navigation_View.services_911consumidor_com.UserDTO(); Usuario = cliente.AccountLogin(new Navigation_View.services_911consumidor_com.UserDTO { Email = UserEmail, Password = Password }, string_key); Xamarin.Auth.Account account = new Xamarin.Auth.Account(Usuario.Email, AccountCore.Dictionary(Usuario.FirstName, Usuario.Email, Password)); AccountStore.Create(this).Save(account, "consumidor"); new Android.Support.V7.App.AlertDialog.Builder(this) .SetMessage("Conexión Satisfactoria") .SetPositiveButton("OK", delegate { Console.WriteLine("OK"); }) .SetTitle("ATENCIÓN") .Show(); StartActivity(typeof(MainActivity)); } catch (Exception ex) { var MensajeError = ex.Message.Remove(0, 43); new Android.Support.V7.App.AlertDialog.Builder(this) .SetMessage("Error en la conexión: " + MensajeError) .SetPositiveButton("OK", delegate { Console.WriteLine("OK"); }) .SetTitle("ATENCIÓN") .Show(); } }; // Create your application here }