2014-08-02 10:50:46 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Saviour_Backup_System
|
|
|
|
|
{
|
2014-11-11 21:37:56 +00:00
|
|
|
|
class notificationIcon : IDisposable
|
2014-08-02 10:50:46 +01:00
|
|
|
|
{
|
2014-11-11 22:55:14 +00:00
|
|
|
|
public NotifyIcon notifyIcon = new NotifyIcon() ;
|
|
|
|
|
public ContextMenu contextMenu = new ContextMenu();
|
2014-08-02 10:50:46 +01:00
|
|
|
|
|
2014-11-11 22:55:14 +00:00
|
|
|
|
public notificationIcon()
|
2014-08-02 10:50:46 +01:00
|
|
|
|
{
|
|
|
|
|
notifyIcon.Text = "Saviour Backup System";
|
|
|
|
|
notifyIcon.Icon = Properties.Resources.redCDIconICO;
|
2014-11-04 17:26:59 +00:00
|
|
|
|
populateList();
|
2014-08-02 10:50:46 +01:00
|
|
|
|
notifyIcon.ContextMenu = contextMenu;
|
|
|
|
|
notifyIcon.Visible = true; //finally displays the tray icon
|
|
|
|
|
}
|
2014-11-06 10:22:13 +00:00
|
|
|
|
|
2014-11-11 22:47:26 +00:00
|
|
|
|
private void populateList() {
|
2014-11-04 17:26:59 +00:00
|
|
|
|
contextMenu.MenuItems.Add("Show Interface", displayWindow);
|
2014-11-06 10:22:13 +00:00
|
|
|
|
contextMenu.MenuItems.Add("Copy Progress", showProgress);
|
2014-11-08 09:27:36 +00:00
|
|
|
|
contextMenu.MenuItems.Add("Exit", closeProgram);
|
2014-11-04 17:26:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-11-06 10:22:13 +00:00
|
|
|
|
private void displayWindow(object sender, EventArgs e) { setup.MW.showDisplay(); }
|
2014-11-11 21:56:37 +00:00
|
|
|
|
private void showProgress(object sender, EventArgs e) { return; } //nothing yet!
|
2014-11-08 09:27:36 +00:00
|
|
|
|
private void closeProgram(object sender, EventArgs e) { setup.closeProgram(); }
|
|
|
|
|
|
2014-11-11 22:55:14 +00:00
|
|
|
|
public void displayStillRunning() {
|
2014-11-11 21:56:37 +00:00
|
|
|
|
string title = "I'm Still Here!";
|
|
|
|
|
string message = "Saviour Backup System is still running in the background";
|
|
|
|
|
notifyIcon.ShowBalloonTip(2000, title, message, ToolTipIcon.Info);
|
2014-11-04 17:26:59 +00:00
|
|
|
|
}
|
2014-11-11 21:56:37 +00:00
|
|
|
|
|
2014-11-11 21:37:56 +00:00
|
|
|
|
public void Dispose()//deconstructor - for memory management
|
|
|
|
|
{
|
|
|
|
|
notifyIcon.Dispose();
|
|
|
|
|
contextMenu.Dispose();
|
|
|
|
|
}
|
2014-08-02 10:50:46 +01:00
|
|
|
|
}
|
|
|
|
|
}
|