//Called when window is resized (such as minimized) private void main_Resize(object sender, EventArgs e) { updateLatestReview(); BewanderTrayIcon.BalloonTipTitle = "Notifcations"; BewanderTrayIcon.BalloonTipText = "Bewander is running in the system tray!"; //If the window is minimized if (FormWindowState.Minimized == this.WindowState) { //Make system tray icon visible BewanderTrayIcon.Visible = true; //Display balloon notifcation window BewanderTrayIcon.ShowBalloonTip(300); //Remove application from taskbar this.ShowInTaskbar = false; //Hide form window this.Hide(); } else if (FormWindowState.Maximized == this.WindowState) { //If the window is maximized, don't display the system tray icon anymore. BewanderTrayIcon.Visible = false; } }
//Called when main window loads private void main_Load(object sender, EventArgs e) { //Check that the config is indeed loaded and not blank. if (Properties.Settings.Default.inputdirectory != "" && Properties.Settings.Default.outputdirectory != "") { //If user setting startMinimized = true if (Properties.Settings.Default.startMinimized) { //Make system tray icon visible BewanderTrayIcon.Visible = true; //Don't show Bewander app in taskbar this.ShowInTaskbar = false; //Hide bewander window. this.Hide(); //Set balloon tip information to notify user that the app successfully launched (some people might not notice! darn end users!) BewanderTrayIcon.BalloonTipTitle = "Notifcations"; BewanderTrayIcon.BalloonTipText = "Bewander started in system tray!"; //Display balloon tip for 5 seconds BewanderTrayIcon.ShowBalloonTip(300); } //Don't display the tray icon, because the user doesn't want to start minimized. else { BewanderTrayIcon.Visible = false; } updateLatestReview(); } }