Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_userProfile);

            userName     = FindViewById <EditText>(Resource.Id.displayName);
            userEmail    = FindViewById <EditText>(Resource.Id.displayEmail);
            userPassword = FindViewById <EditText>(Resource.Id.displayPassword);
            userAge      = FindViewById <EditText>(Resource.Id.displayAge);
            btn_Back     = FindViewById <Button>(Resource.Id.btnBack);

            myDB     = new DBHelperClass(this);
            myName   = Intent.GetStringExtra("userName");
            userData = myDB.getUserData(myName);

            userName.Text     = userData[0];
            userEmail.Text    = userData[1];
            userPassword.Text = userData[2];
            userAge.Text      = userData[3];

            userName.Enabled     = false;
            userEmail.Enabled    = false;
            userPassword.Enabled = false;
            userAge.Enabled      = false;

            btn_Back.Click += backToList;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_signUp);

            alert = new Android.App.AlertDialog.Builder(this);
            myDB  = new DBHelperClass(this);

            userName     = FindViewById <EditText>(Resource.Id.inputName);
            userEmail    = FindViewById <EditText>(Resource.Id.inputEmail);
            userPassword = FindViewById <EditText>(Resource.Id.inputPassword);
            userAge      = FindViewById <EditText>(Resource.Id.inputAge);

            btn_submit = FindViewById <Button>(Resource.Id.btnSignUp);

            btn_submit.Click += delegate
            {
                var nameValue     = userName.Text;
                var emailValue    = userEmail.Text;
                var passwordValue = userPassword.Text;
                var ageValue      = userAge.Text;

                if ((nameValue.Trim().Equals("") || nameValue.Length < 0) ||
                    (emailValue.Trim().Equals("") || emailValue.Length < 0) ||
                    (passwordValue.Trim().Equals("") || passwordValue.Length < 0) ||
                    (ageValue.Trim().Equals("") || ageValue.Length < 0))
                {
                    alert.SetTitle("Error");
                    alert.SetMessage("Enter right values in all fields.");
                    alert.SetPositiveButton("OK", alertOKButton);
                    alert.SetNegativeButton("Cancel", alertOKButton);
                    Dialog myDialog = alert.Create();
                    myDialog.Show();
                }
                else
                {
                    myDB.insertValue(nameValue, emailValue, passwordValue, Convert.ToInt32(ageValue));
                    Console.WriteLine("Insertion Success");

                    Intent newScreen = new Intent(this, typeof(MainActivity));
                    StartActivity(newScreen);
                }
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_listOfUsers);

            // Create your application here
            mySearch = FindViewById <SearchView>(Resource.Id.searchBtn);
            myList   = FindViewById <ListView>(Resource.Id.listUsers);

            myDB  = new DBHelperClass(this);
            users = myDB.getList();

            // Defined Array values to show in ListView
            Myadapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, users);

            // Assign adapter to ListView
            myList.Adapter            = Myadapter;
            myList.ItemClick         += List1_ItemClick;
            mySearch.QueryTextChange += userSearch;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_logIn);
            myDB  = new DBHelperClass(this);
            alert = new Android.App.AlertDialog.Builder(this);

            name     = Intent.GetStringExtra("userName");
            email    = Intent.GetStringExtra("userEmail");
            password = Intent.GetStringExtra("userPassword");
            age      = Intent.GetStringExtra("userAge");

            userName     = FindViewById <EditText>(Resource.Id.displayName);
            userEmail    = FindViewById <EditText>(Resource.Id.displayEmail);
            userPassword = FindViewById <EditText>(Resource.Id.displayPassword);
            userAge      = FindViewById <EditText>(Resource.Id.displayAge);

            btn_edit     = FindViewById <Button>(Resource.Id.btnEditProfile);
            btn_save     = FindViewById <Button>(Resource.Id.btnSaveProfile);
            btn_listUser = FindViewById <Button>(Resource.Id.btnListOfUsers);
            btn_home     = FindViewById <Button>(Resource.Id.btnBack);

            userName.Text     = name;
            userEmail.Text    = email;
            userPassword.Text = password;
            userAge.Text      = age;

            userName.Enabled     = false;
            userEmail.Enabled    = false;
            userPassword.Enabled = false;
            userAge.Enabled      = false;
            btn_save.Enabled     = false;

            // Click events
            btn_edit.Click     += editBtnClickEvent;
            btn_save.Click     += saveBtnClickEvent;
            btn_home.Click     += backBtnClickEvent;
            btn_listUser.Click += listUsersClickEvent;
        }
Esempio n. 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            userName     = FindViewById <EditText>(Resource.Id.myEmail);
            userPassword = FindViewById <EditText>(Resource.Id.myPassword);
            btn_logIn    = FindViewById <Button>(Resource.Id.logIn_button1);
            btn_signUp   = FindViewById <Button>(Resource.Id.signUp_Button);

            alert = new Android.App.AlertDialog.Builder(this);

            myDB = new DBHelperClass(this);

            btn_logIn.Click += delegate
            {
                var value1 = userName.Text;
                var value2 = userPassword.Text;

                System.Console.WriteLine("UserName: "******"Password: "******" ") || value1.Length < 0 || value2.Trim().Equals(" ") || value2.Length < 0)
                {
                    alert.SetTitle("Error");
                    alert.SetMessage("Please Enter Valid Data");
                    alert.SetPositiveButton("OK", alertOKButton);
                    alert.SetNegativeButton("Cancel", alertOKButton);
                    Dialog myDialog = alert.Create();
                    myDialog.Show();
                }
                else
                {
                    if (myDB.checkUser(value1, value2))
                    {
                        string[] userData = myDB.getUserData(value1, value2);

                        Intent newScreen = new Intent(this, typeof(LogInActivity));
                        newScreen.PutExtra("userName", userData[0]);
                        newScreen.PutExtra("userEmail", userData[1]);
                        newScreen.PutExtra("userPassword", userData[2]);
                        newScreen.PutExtra("userAge", userData[3]);
                        StartActivity(newScreen);
                    }
                    else
                    {
                        alert.SetTitle("Error");
                        alert.SetMessage("Invalid Email id or Password");
                        alert.SetPositiveButton("OK", alertOKButton);
                        Dialog myDialog = alert.Create();
                        myDialog.Show();
                    }
                }
            };

            btn_signUp.Click += delegate
            {
                Intent signUpScreen = new Intent(this, typeof(SignupActivity));
                StartActivity(signUpScreen);
            };
        }