1
Fork 0

modified to attempt to fix notification icon

This commit is contained in:
Jake Howard 2014-11-04 15:55:18 +00:00
parent b56df5c71c
commit f89dd254ba
2 changed files with 19 additions and 24 deletions

View file

@ -9,15 +9,13 @@ namespace Saviour_Backup_System
{ {
class notificationIcon class notificationIcon
{ {
internal static NotifyIcon notifyIcon; internal NotifyIcon notifyIcon = new NotifyIcon() ;
internal static ContextMenu contextMenu; internal static ContextMenu contextMenu = new ContextMenu();
internal static void init() internal notificationIcon()
{ {
contextMenu = new ContextMenu();
contextMenu.MenuItems.Add("Show Interface", displayWindow); contextMenu.MenuItems.Add("Show Interface", displayWindow);
notifyIcon = new NotifyIcon();
notifyIcon.Text = "Saviour Backup System"; notifyIcon.Text = "Saviour Backup System";
notifyIcon.Icon = Properties.Resources.redCDIconICO; notifyIcon.Icon = Properties.Resources.redCDIconICO;
@ -25,9 +23,6 @@ namespace Saviour_Backup_System
notifyIcon.Visible = true; //finally displays the tray icon notifyIcon.Visible = true; //finally displays the tray icon
} }
private static void displayWindow(object sender, EventArgs e) private static void displayWindow(object sender, EventArgs e) { setup.MW.Show(); }
{
setup.MW.Show();
}
} }
} }

View file

@ -14,25 +14,25 @@ namespace Saviour_Backup_System
{ {
class setup class setup
{ {
internal static NotifyIcon notifyIcon;
internal static ContextMenu contextMenu;
static string databaseName = databaseTools.databaseName; static string databaseName = databaseTools.databaseName;
internal static string[] runtimeArguements = null; internal static string[] runtimeArguements = null;
internal static mainWindow MW = null; internal static mainWindow MW;
internal static void initProgram(string[] args) internal static void initProgram(string[] args)
{ {
runtimeArguements = args; runtimeArguements = args;
notificationIcon.init();
if (args.Length == 0) //if the program is run out-right or not from startup notificationIcon icon = new notificationIcon();
{ if (args.Length == 0) //if the program is run out-right or not from startup
MW = new mainWindow(); {
} Application.Run(MW);
else if (args[0] == "STARTUP") //if the program is run when the computer starts up }
{ else if (args[0] == "STARTUP") //if the program is run when the computer starts up
MW = new mainWindow(); {
} Application.Run(MW);
MainUI = MW;
MW.Hide();
}
//if (!File.Exists(databaseName)) { setupDatabase(); } // If the program has been run before, then the database will exist, so use that to test it. //if (!File.Exists(databaseName)) { setupDatabase(); } // If the program has been run before, then the database will exist, so use that to test it.
} }
@ -74,7 +74,7 @@ namespace Saviour_Backup_System
internal static void closeProgram(object sender, FormClosingEventArgs e) internal static void closeProgram(object sender, FormClosingEventArgs e)
{ {
notificationIcon.notifyIcon.Dispose(); //
} }
} }
} }