// On startup, load settings and start connecting private void Application_Startup(object sender, StartupEventArgs e) { if (!Settings.Load()) { // Failed to load settings, print error MessageBox.Show("Failed to load settings. Please contact an administrator."); Environment.Exit(-1); // Fatal error } Connection = new Connection(); // Synchronously connect so that nothing happens until we're connected NetHandler(); // Initialise the tray icon MainWindow = new TrayIcon(Connection, CurrentUser, CurrentRoom); // Show the logon message MainWindow.ShowBalloon("Room Booking System started", "The Room Booking System client has started.", System.Windows.Forms.ToolTipIcon.Info); }