Ejemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the create account layout resource
            SetContentView(Resource.Layout.CreateAccount);

            Button createAccountButton = FindViewById<Button>(Resource.Id.CreateAccountButton);
            EditText newUsername = FindViewById<EditText>(Resource.Id.NewUsernameEditText);
            EditText newPassword = FindViewById<EditText>(Resource.Id.NewPasswordEditText);
            EditText newFullName = FindViewById<EditText>(Resource.Id.NewFullNameEditText);

            _manager = new Manager();

            createAccountButton.Click += delegate
            {
                bool success = CreateAccount(newUsername.Text, newPassword.Text, newFullName.Text);

                if (success)
                {
                    Toast.MakeText(this, string.Format("Successfully create an account for {0}", newFullName.Text), ToastLength.Short);
                    Finish();
                }
                else
                {
                    Toast.MakeText(this, string.Format("Account wasn't created.", newFullName.Text), ToastLength.Short);
                }
            };
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            _manager = new Manager();

            SetContentView(Resource.Layout.FridgeTopics);

            ListView fridgeTopicsListView = FindViewById<ListView>(Resource.Id.FridgeTopicsListView);

            string[] junk = new[] {"Poop", "More poop", "And even more poop"};

            fridgeTopicsListView.Adapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItem1, junk);

            // Create your application here
        }
Ejemplo n.º 3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button>(Resource.Id.LogIn);
            EditText username = FindViewById<EditText>(Resource.Id.EditUserName);
            EditText password = FindViewById<EditText>(Resource.Id.EditPassword);
            Button createAccount = FindViewById<Button>(Resource.Id.CreateAccountButtonMainScreen);
            Button deleteDBButton = FindViewById<Button>(Resource.Id.DeleteDBButton);

            _manager = new Manager();

            button.Click += delegate
            {
                bool successful = LogIn(username.Text, password.Text);

                if (!successful)
                {
                    username.Text = string.Empty;
                    password.Text = string.Empty;
                }
                else
                {
                    Finish();
                }
            };

            createAccount.Click += delegate
            {
                CreateAccount();
            };

            // Temporary for testing purposes
            deleteDBButton.Click += delegate
            {
                Database.DeleteDatabase();
                _manager = new Manager();
            };
        }