Skip to content
Snippets Groups Projects
Commit 5b858d45 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Document behavior of UpdateTrayIcon.

Refers to #2
parent 76438d96
Branches
Tags
No related merge requests found
...@@ -479,6 +479,10 @@ namespace ATxTray ...@@ -479,6 +479,10 @@ namespace ATxTray
} }
private void UpdateTrayIcon() { private void UpdateTrayIcon() {
// if a transfer is running and active show the transfer icon, alternating between its
// two variants every second ("blinking")
// NOTE: this is independent of a status change as the blinking should still happen
// even if the status (file) has not been updated in between
if (_txInProgress && !_serviceSuspended) { if (_txInProgress && !_serviceSuspended) {
if (DateTime.Now.Second % 2 == 0) { if (DateTime.Now.Second % 2 == 0) {
_notifyIcon.Icon = _tiTx0; _notifyIcon.Icon = _tiTx0;
...@@ -487,19 +491,23 @@ namespace ATxTray ...@@ -487,19 +491,23 @@ namespace ATxTray
} }
} }
// now we can check if a status change occurred and just return otherwise:
if (!_statusChanged) if (!_statusChanged)
return; return;
// show the "stopped" icon if the service process is not running:
if (!_serviceProcessAlive) { if (!_serviceProcessAlive) {
_notifyIcon.Icon = _tiStopped; _notifyIcon.Icon = _tiStopped;
return; return;
} }
// show the "suspended" icon of the service is in the corresponding state:
if (_serviceSuspended) { if (_serviceSuspended) {
_notifyIcon.Icon = _tiSuspended; _notifyIcon.Icon = _tiSuspended;
return; return;
} }
// if none of the above is true and no transfer is running show the default icon:
if (!_txInProgress) { if (!_txInProgress) {
_notifyIcon.Icon = _tiDefault; _notifyIcon.Icon = _tiDefault;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment