/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> void LoginEmail(string emailAddress) { BeginInvoke(new Action(() => { loadingPictureBox.Visible = true; loadingPictureBox.StartAnimation(); })); EventWaitHandle wait = new EventWaitHandle(false, EventResetMode.ManualReset); SlackClient.StartAuth((r) => { if (r.ok) { authResponse(r); } wait.Set(); }, emailAddress); wait.WaitOne(); BeginInvoke(new Action(() => { loadingPictureBox.StopAnimation(); loadingPictureBox.Visible = false; })); }
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(); }