1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
saviour-backup-system/Saviour Backup System/notificationIcon.cs

47 lines
1.6 KiB
C#
Raw Normal View History

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
{
class notificationIcon : IDisposable
2014-08-02 10:50:46 +01:00
{
public NotifyIcon notifyIcon = new NotifyIcon() ;
public ContextMenu contextMenu = new ContextMenu();
2014-08-02 10:50:46 +01:00
public notificationIcon()
2014-08-02 10:50:46 +01:00
{
notifyIcon.Text = "Saviour Backup System";
notifyIcon.Icon = Properties.Resources.redCDIconICO;
populateList();
2014-08-02 10:50:46 +01:00
notifyIcon.ContextMenu = contextMenu;
notifyIcon.Visible = true; //finally displays the tray icon
}
2014-11-11 22:47:26 +00:00
private void populateList() {
contextMenu.MenuItems.Add("Show Interface", displayWindow);
contextMenu.MenuItems.Add("Copy Progress", showProgress);
contextMenu.MenuItems.Add("Exit", closeProgram);
}
private void displayWindow(object sender, EventArgs e) { setup.MW.showDisplay(); }
private void showProgress(object sender, EventArgs e) { return; } //nothing yet!
private void closeProgram(object sender, EventArgs e) { setup.closeProgram(); }
public void displayStillRunning() {
string title = "I'm Still Here!";
string message = "Saviour Backup System is still running in the background";
notifyIcon.ShowBalloonTip(2000, title, message, ToolTipIcon.Info);
}
public void Dispose()//deconstructor - for memory management
{
notifyIcon.Dispose();
contextMenu.Dispose();
}
2014-08-02 10:50:46 +01:00
}
}