diff --git a/ATXTray/AutoTxTray.cs b/ATXTray/AutoTxTray.cs index f52e7f22fc221d5bd765ee8484c92ff164de190f..0f1bd12a24c90a7fac8f95133306cf7bbec11c3e 100644 --- a/ATXTray/AutoTxTray.cs +++ b/ATXTray/AutoTxTray.cs @@ -30,6 +30,11 @@ namespace ATXTray private static long _txSize; private readonly NotifyIcon _notifyIcon = new NotifyIcon(); + private readonly Icon _tiDefault; + private readonly Icon _tiStopped; + private readonly Icon _tiSuspended; + private readonly Icon _tiTx0; + private readonly Icon _tiTx1; private readonly ContextMenuStrip _cmStrip = new ContextMenuStrip(); private readonly ToolStripMenuItem _miExit = new ToolStripMenuItem(); private readonly ToolStripMenuItem _miTitle = new ToolStripMenuItem(); @@ -39,9 +44,16 @@ namespace ATXTray private readonly ToolStripMenuItem _miTxEnqueue = new ToolStripMenuItem(); public AutoTxTray() { + _tiDefault = new Icon("AutoTx.ico"); + _tiStopped = new Icon("icon-stopped.ico"); + _tiSuspended = new Icon("icon-suspended.ico"); + _tiTx0 = new Icon("icon-tx-0.ico"); + _tiTx1 = new Icon("icon-tx-1.ico"); + + _notifyIcon.Icon = _tiStopped; _notifyIcon.Visible = true; - _notifyIcon.Icon = new Icon("AutoTx.ico"); _notifyIcon.DoubleClick += StartNewTransfer; + // this doesn't work properly, the menu will not close etc. so we disable it for now: // _notifyIcon.Click += ShowContextMenu; @@ -125,6 +137,8 @@ namespace ATXTray txProgress = _txSize.ToString(); } + UpdateTrayIcon(); + if (!_statusChanged) return; @@ -248,5 +262,33 @@ namespace ATXTray "Transfer completed.", ToolTipIcon.Info); } } + + private void UpdateTrayIcon() { + if (_txInProgress && + !_svcSuspended) { + if (DateTime.Now.Second % 2 == 0) { + _notifyIcon.Icon = _tiTx0; + } else { + _notifyIcon.Icon = _tiTx1; + } + } + + if (!_statusChanged) + return; + + if (!_svcRunning) { + _notifyIcon.Icon = _tiStopped; + return; + } + + if (_svcSuspended) { + _notifyIcon.Icon = _tiSuspended; + return; + } + + if (!_txInProgress) { + _notifyIcon.Icon = _tiDefault; + } + } } } diff --git a/ATXTray/icon-default.ico b/ATXTray/icon-default.ico new file mode 100644 index 0000000000000000000000000000000000000000..86d3957ca994afc11765c905518831604be8b3fd Binary files /dev/null and b/ATXTray/icon-default.ico differ diff --git a/ATXTray/icon-stopped.ico b/ATXTray/icon-stopped.ico new file mode 100644 index 0000000000000000000000000000000000000000..02d364443336f196074efd097d7ee755279f7275 Binary files /dev/null and b/ATXTray/icon-stopped.ico differ diff --git a/ATXTray/icon-suspended.ico b/ATXTray/icon-suspended.ico new file mode 100644 index 0000000000000000000000000000000000000000..55b7e1ce461aefb3ac004ce8d30f87d284bd1679 Binary files /dev/null and b/ATXTray/icon-suspended.ico differ diff --git a/ATXTray/icon-tx-0.ico b/ATXTray/icon-tx-0.ico new file mode 100644 index 0000000000000000000000000000000000000000..a0a4a78fe06861289a3d84142137ce7aa3ca0553 Binary files /dev/null and b/ATXTray/icon-tx-0.ico differ diff --git a/ATXTray/icon-tx-1.ico b/ATXTray/icon-tx-1.ico new file mode 100644 index 0000000000000000000000000000000000000000..c8da555da28babd247932ab7bf040f7a978f70a8 Binary files /dev/null and b/ATXTray/icon-tx-1.ico differ