private void MainForm_Shown(object sender, EventArgs e) { if (IsLogin) { currentClient.ConnectToChat(); } else { f1.Close(); } }