public TextInputPanel(string labelText, int x, int y, int w, int h) : base(x, y, w, h) { Bounds = new System.Drawing.Rectangle(x, y, w, h); lblTitle = new FluidLabel(labelText, 10, 5, w - 20, 30); lblTitle.ForeColor = Color.White; lblTitle.Anchor = AnchorBL; lblTitle.Font = Theme.Current.ModalFont; Controls.Add(lblTitle); txtData = new FluidTextBox("", 10, 25, w - 20, 30); txtData.ForeColor = Color.Black; txtData.Anchor = AnchorBL; txtData.Font = Theme.Current.ModalFont; Controls.Add(txtData); btnOK = new FluidButton("OK", 10, 65, 80, 32); btnOK.BackColor = Color.Green; btnOK.GradientFill = Theme.Current.ButtonsGradianted; btnOK.Font = Theme.Current.ButtonFont; btnOK.Anchor = AnchorBL; btnOK.Click += new EventHandler(btnOK_click); Controls.Add(btnOK); btnKeyboard = new FluidButton("", 100, 65, 40, 32); btnKeyboard.Image = Resources.keyboard; btnKeyboard.BackColor = Color.White; btnKeyboard.Click += new EventHandler(btnKeyboard_Click); btnKeyboard.Anchor = AnchorBL; Controls.Add(btnKeyboard); btnCancel = new FluidButton("Cancel", 150, 65, 80, 32); btnCancel.BackColor = Color.Red; btnCancel.GradientFill = Theme.Current.ButtonsGradianted; btnCancel.Anchor = AnchorBL; btnCancel.Click += new EventHandler(btnCancel_click); Controls.Add(btnCancel); modalBackground = new ModalBackground(); modalBackground.ShowMaximized(); Anchor = AnchorAll; Show(); }
private void ShowIncorrectPasswordDialog() { txtPassword.Text = ""; SelectedTextBox = txtPassword; MessageDialog.Show("Login Failed. \nPlease try again.", "OK", null); }
private bool SelectNextTextBox() { if (selectedTextBox == txtEmail) SelectedTextBox = txtPassword; selectedTextBox.Focus(); return true; }
void passwordTextBox_GotFocus(object sender, EventArgs e) { SelectedTextBox = (FluidTextBox)sender; if (SelectedTextBox == txtPassword) { //Disable T9? InputModeEditor.SetInputMode(Form1.Instance, InputMode.AlphaABC); } else { InputModeEditor.SetInputMode(Form1.Instance, InputMode.Default); } }
FluidTextBox AddTextLabel(string title, int top, ref FluidLabel label, bool visible) { label = new FluidLabel(title, 10, top + 5, Width - 20, 16); label.Anchor = AnchorStyles.Left | AnchorStyles.Top; label.Font = new Font(FontFamily.GenericSansSerif, 8f, FontStyle.Regular); label.ForeColor = Color.White; label.ShadowColor = Color.Black; label.Visible = visible; Controls.Add(label); FluidTextBox textbox = new FluidTextBox("", 10, top + 19, Width - 20, 24); textbox.Anchor = AnchorStyles.Left | AnchorStyles.Top; textbox.Visible = visible; textbox.CanShowInputPanel = false; Controls.Add(textbox); return textbox; }
protected virtual void OnEnter() { if (Enter != null) { if (string.IsNullOrEmpty(txtEmail.Text)) { ShowEmptyPasswordDialog(); SelectedTextBox = txtEmail; txtEmail.Focus(); return; } if (string.IsNullOrEmpty(txtPassword.Text)) { ShowEmptyPasswordDialog(); SelectedTextBox = txtPassword; txtPassword.Focus(); return; } Host.Cursor = Cursors.WaitCursor; try { Form1.Instance.DropBox.Login(txtEmail.Text, txtPassword.Text); } catch (DropException ex) { MessageDialog.Show(ex.Message, "", null); return; } catch (Exception ex) { MessageDialog.Show("Login Failed. \nPlease try again.", "OK", null); return; } Host.Cursor = Cursors.Default; if (Form1.Instance.DropBox.LoggedIn) { if (rememberMe) { Settings.Instance.UserToken = Form1.Instance.DropBox.UserLogin.Token; Settings.Instance.UserSecret = Form1.Instance.DropBox.UserLogin.Secret; Settings.Instance.RememberMe = true; } else { Settings.Instance.RememberMe = false; } Enter(this, EventArgs.Empty); } else { ShowIncorrectPasswordDialog(); } } }
protected override void InitControl() { base.InitControl(); EnableDoubleBuffer = true; Bounds = new Rectangle(0, 0, 240, 300); this.BackColor = Color.FromArgb(33, 124, 197); this.PaintBackground += new EventHandler<FluidPaintEventArgs>(login_Paint); txtEmail = AddTextLabel("Email", 35, ref lblEmail, true); txtPassword = AddTextLabel("Password", 90, ref lblPassword, true); txtPassword.PasswordChar = '*'; txtEmail.GotFocus += new EventHandler(passwordTextBox_GotFocus); txtPassword.GotFocus += new EventHandler(passwordTextBox_GotFocus); btnRemember = new FluidButton("", 12, 150, 20, 20); btnRemember.BackColor = Color.White; btnRemember.PressedBackColor = Color.White; btnRemember.Image = null; btnRemember.Click += new EventHandler(btnRemember_Click); Controls.Add(btnRemember); lblRemember = new FluidLabel("Remember me?", 38, 150, 120, 20); lblRemember.Click += new EventHandler(btnRemember_Click); lblRemember.ForeColor = Color.Black; lblRemember.ShadowColor = Color.White; lblRemember.Font = new Font("Arial", 9, FontStyle.Bold); Controls.Add(lblRemember); btnLogin = new FluidButton("Login", 10, this.Height - 35, 80, 32); btnLogin.BackColor = Color.Green; btnLogin.Click += new EventHandler(btnLogin_Click); btnLogin.ForeColor = Color.Black; btnLogin.Anchor = AnchorBL; btnLogin.Font = Theme.Current.ButtonFont; Controls.Add(btnLogin); btnKeyboard = new FluidButton("", 100, this.Height - 35, 40, 32); btnKeyboard.Image = Resources.keyboard; btnKeyboard.BackColor = Color.White; btnKeyboard.Click += new EventHandler(btnKeyboard_Click); btnKeyboard.Anchor = AnchorBL; btnKeyboard.ShadowColor = Color.Black; Controls.Add(btnKeyboard); btnExit = new FluidButton("Exit", 150, this.Height - 35, 80, 32); btnExit.BackColor = Color.Red; btnExit.Click += new EventHandler(btnExit_Click); btnExit.ForeColor = Color.Black; btnExit.Anchor = AnchorBL; btnExit.Font = Theme.Current.ButtonFont; Controls.Add(btnExit); if (Settings.Instance != null) { if (Settings.Instance.RememberMe) { ////not too sure what to do here... //txtEmail.Text = Settings.Instance.UserEmail; //txtPassword.Text = Settings.Instance.UserPassword; rememberMe = true; btnRemember.Image = Resources.accept; } } }