Ejemplo n.º 1
0
        private void CreateRegisterLoginTabs()
        {
            ActionBar.RemoveAllTabs();

            var tabReg = ActionBar.NewTab();

            tabReg.SetText(Resource.String.register);
            tabReg.TabSelected += TabReg_TabSelected;

            var tabLogin = ActionBar.NewTab();

            tabLogin.SetText(Resource.String.login);

            if (VotingsUser.CheckUserExists())
            {
                VotingsUser.GetKeysFromConfig();
                tabLogin.TabSelected += TabLogin_TabSelected;

                ActionBar.AddTab(tabLogin);
                ActionBar.AddTab(tabReg);
                tabLogin.Select();
            }
            else
            {
                tabLogin.TabSelected += (s, e) => { };

                ActionBar.AddTab(tabReg);
                ActionBar.AddTab(tabLogin);
                tabReg.Select();
            }
        }
Ejemplo n.º 2
0
        private void ButtonReg_Click(object sender, EventArgs e)
        {
            EditText editTextPublicKey  = FindViewById <EditText>(Resource.Id.editTextPublicKeyReg);
            EditText editTextPrivateKey = FindViewById <EditText>(Resource.Id.editTextPrivateKeyReg);
            EditText editTextPass1      = FindViewById <EditText>(Resource.Id.editTextPassReg);
            EditText editTextPass2      = FindViewById <EditText>(Resource.Id.editTextPass2Reg);


            editTextPass1.SetTextColor(Color.White);
            editTextPass2.SetTextColor(Color.White);
            editTextPublicKey.SetTextColor(Color.White);
            editTextPrivateKey.SetTextColor(Color.White);


            if (!CommonHelpers.CheckKeys(editTextPublicKey.Text, editTextPrivateKey.Text))
            {
                editTextPublicKey.SetTextColor(Color.OrangeRed);
                editTextPrivateKey.SetTextColor(Color.OrangeRed);
            }
            else if (editTextPass1.Text != editTextPass2.Text)
            {
                editTextPublicKey.SetTextColor(Color.OrangeRed);
                editTextPrivateKey.SetTextColor(Color.OrangeRed);
            }
            else
            {
                VotingsUser.ClearUserData();
                VotingsUser.Register(editTextPublicKey.Text, editTextPrivateKey.Text, editTextPass1.Text);
                VotingsUser.GetKeysFromConfig();

                if (VotingsUser.Login(editTextPass1.Text))
                {
                    CreateVotingSettingStatisticTabs();
                }
            }
        }