public PasswordLogin(UserTeamCombo userTeam, Action <string> OnPasswordAuthSuccess) { combo = userTeam; onPasswordAuth = OnPasswordAuthSuccess; title = new Label() { Text = string.Format("Enter your password for {0}", userTeam.team), Font = new Font(CustomFonts.Fonts.Families[1], 20) }; title.Size = title.PreferredSize; passwordInput = new CustomTextbox(ProcessAuth, "Password"); passwordInput.BorderRadius = 4; passwordInput.Size = new Size(300, 34); passwordInput.OnError += (s) => { BeginInvoke(new Action(() => { loadingAnimation.StopAnimation(); loadingAnimation.Visible = false; })); }; passwordInput.PreCallback += () => signin.Enabled = false; signin = new CustomButton() { Text = "Sign in" }; signin.Size = signin.PreferredSize; signin.Click += (o, e) => { passwordInput.PressEnter(); }; loadingAnimation = new SlackLoading(); loadingAnimation.Size = new Size(70, 70); loadingAnimation.Visible = false; passwordInput.PasswordChar = '*'; Controls.Add(passwordInput); Controls.Add(loadingAnimation); Controls.Add(title); Controls.Add(signin); DoResize(); }
private void InitializeComponent() { this.welcome = new System.Windows.Forms.Label(); this.howTo = new Label(); this.emailContainer = new CustomTextbox(LoginEmail, "Your email address"); emailContainer.OnError += (s) => { loadingPictureBox.StopAnimation(); loadingPictureBox.Visible = false; }; this.emailContainer.SuspendLayout(); this.SuspendLayout(); // // welcome // this.welcome.AutoSize = true; this.welcome.Location = new System.Drawing.Point(222, 125); this.welcome.Name = "welcome"; this.welcome.Size = new System.Drawing.Size(55, 13); this.welcome.Text = "Welcome!"; this.welcome.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.welcome.Parent = this; this.welcome.BackColor = Color.Transparent; // // howTo // this.howTo.AutoSize = true; this.howTo.Name = "introHowTo"; this.howTo.Text = "Please type in your email below and press enter to get started."; this.howTo.Size = this.howTo.PreferredSize; this.howTo.TextAlign = ContentAlignment.MiddleCenter; this.howTo.Parent = this; this.howTo.BackColor = Color.Transparent; // // emailContainer // this.emailContainer.Location = new System.Drawing.Point(143, 183); this.emailContainer.Name = "emailContainer"; this.emailContainer.Size = new System.Drawing.Size(300, 34); this.emailContainer.TabIndex = 2; this.emailContainer.BorderRadius = 4; login = new CustomButton() { Text = "Retrieve account" }; login.Size = login.PreferredSize; login.Location = new Point((emailContainer.Width - login.Width) / 2, emailContainer.Bottom + 7); login.Click += (o, e) => LoginEmail(emailContainer.Text); Controls.Add(login); this.loadingPictureBox = new SlackLoading(); this.loadingPictureBox.Size = new Size(70, 70); this.loadingPictureBox.Parent = this; this.loadingPictureBox.BackColor = Color.Transparent; this.loadingPictureBox.Visible = false; this.Controls.Add(loadingPictureBox); // // EmailLogin // this.Controls.Add(this.emailContainer); this.Controls.Add(this.welcome); this.Controls.Add(howTo); this.Name = "EmailLogin"; this.Size = new System.Drawing.Size(500, 400); this.emailContainer.ResumeLayout(false); this.emailContainer.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); }