From f89dd254ba6215102d4858066b254ce8c2c64311 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 4 Nov 2014 15:55:18 +0000 Subject: [PATCH] modified to attempt to fix notification icon --- Saviour Backup System/notificationIcon.cs | 13 +++------- Saviour Backup System/setup.cs | 30 +++++++++++------------ 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/Saviour Backup System/notificationIcon.cs b/Saviour Backup System/notificationIcon.cs index 1ec1e18..2196084 100644 --- a/Saviour Backup System/notificationIcon.cs +++ b/Saviour Backup System/notificationIcon.cs @@ -9,15 +9,13 @@ namespace Saviour_Backup_System { class notificationIcon { - internal static NotifyIcon notifyIcon; - internal static ContextMenu contextMenu; + internal NotifyIcon notifyIcon = new NotifyIcon() ; + internal static ContextMenu contextMenu = new ContextMenu(); - internal static void init() + internal notificationIcon() { - contextMenu = new ContextMenu(); contextMenu.MenuItems.Add("Show Interface", displayWindow); - notifyIcon = new NotifyIcon(); notifyIcon.Text = "Saviour Backup System"; notifyIcon.Icon = Properties.Resources.redCDIconICO; @@ -25,9 +23,6 @@ namespace Saviour_Backup_System notifyIcon.Visible = true; //finally displays the tray icon } - private static void displayWindow(object sender, EventArgs e) - { - setup.MW.Show(); - } + private static void displayWindow(object sender, EventArgs e) { setup.MW.Show(); } } } diff --git a/Saviour Backup System/setup.cs b/Saviour Backup System/setup.cs index a75f4f0..d6dacb0 100644 --- a/Saviour Backup System/setup.cs +++ b/Saviour Backup System/setup.cs @@ -14,25 +14,25 @@ namespace Saviour_Backup_System { class setup { - internal static NotifyIcon notifyIcon; - internal static ContextMenu contextMenu; static string databaseName = databaseTools.databaseName; internal static string[] runtimeArguements = null; - internal static mainWindow MW = null; - + internal static mainWindow MW; internal static void initProgram(string[] args) { - runtimeArguements = args; - notificationIcon.init(); - if (args.Length == 0) //if the program is run out-right or not from startup - { - MW = new mainWindow(); - } - else if (args[0] == "STARTUP") //if the program is run when the computer starts up - { - MW = new mainWindow(); - } + runtimeArguements = args; + + notificationIcon icon = new notificationIcon(); + if (args.Length == 0) //if the program is run out-right or not from startup + { + Application.Run(MW); + } + else if (args[0] == "STARTUP") //if the program is run when the computer starts up + { + 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. } @@ -74,7 +74,7 @@ namespace Saviour_Backup_System internal static void closeProgram(object sender, FormClosingEventArgs e) { - notificationIcon.notifyIcon.Dispose(); // + } } }