예제 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.proveedores_add);
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            //SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            // Create your application here
            Button button = FindViewById <Button>(Resource.Id.button1);

            //ListView ListaProveedores = FindViewById<ListView>(Resource.Id.listView1);

            EditText Nombre   = FindViewById <EditText>(Resource.Id.edittext1);
            EditText Telefono = FindViewById <EditText>(Resource.Id.edittext2);
            EditText Correo   = FindViewById <EditText>(Resource.Id.edittext3);

            button.Click += (o, e) => {
                Proveedor NewProveedor = new Proveedor {
                    Nombre   = Nombre.Text,
                    Telefono = Telefono.Text,
                    Correo   = Correo.Text
                };
                Intent myIntent = new Intent(this, typeof(proveedores_main));
                ProveedorParcelable parcelable = new ProveedorParcelable {
                    Proveedor = NewProveedor
                };
                myIntent.PutExtra("Proveedor", parcelable);
                SetResult(Result.Ok, myIntent);
                Finish();
            };
            //ActionBar.SetHomeButtonEnabled(true);
            //ActionBar.SetDisplayHomeAsUpEnabled(true);
        }
예제 #2
0
 protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
 {
     try {
         ProveedorParcelable parcelable = (ProveedorParcelable)data.GetParcelableExtra("Proveedor");
         itemProveedor.Add(new Proveedor {
             Nombre      = parcelable.Proveedor.Nombre,
             Telefono    = parcelable.Proveedor.Telefono,
             Correo      = parcelable.Proveedor.Correo,
             Direccion   = "",
             Rfc         = "",
             ProveedorId = 0
         });
         if (parcelable.Proveedor != null)
         {
             NetworkService.ProveedoresService.SaveTodoItemAsync(parcelable.Proveedor, true);
         }
     } catch (Exception) {
         //throw;
     }
 }