public frmMain() { InitializeComponent (); chatForms = new Dictionary<string,frmChat> (); frmLogin frmLogin = new frmLogin (); if (frmLogin.ShowDialog () != System.Windows.Forms.DialogResult.OK) { this.Close (); Application.Exit (); return; } session = new LivecodingSession (LiveCodingChat.LoginFactory.Instance.CreateInstance(frmLogin.LoginMethod),frmLogin.Username); session.PasswordRequested += (object sender, ref string Password) => Password = frmLogin.Password; session.SessionAutenticated += Session_SessionAutenticated;; session.EnsureAuthenticated (); }