using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace MainClient { static class Program { // application loads login form at start [STAThread] static void Main() { // Create new login form and set flag to true LoginForm Login = new LoginForm(); bool flag = true; // If the user clicks the OK button on the login form: if (Login.ShowDialog() == DialogResult.OK) { // Checks for empty text if (Login.Txt() != "") { // Sets the flag to false and runs the chat form flag = false; Form1 form = new Form1(); form.setName(Login.Txt()); Application.Run(form); } else { // restarts app if no text entered MessageBox.Show("Please enter username to continue"); Application.Restart(); } } } } }