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

Check for service suspension and report it.

Refers to #2
parent 2d9f5616
No related branches found
No related tags found
No related merge requests found
......@@ -87,6 +87,7 @@ namespace ATXTray
if (_svcRunning) {
serviceRunning = "OK";
ReadStatus();
UpdateSvcSuspended();
if ((DateTime.Now - _status.LastStatusUpdate).TotalSeconds < 60)
heartBeat = "OK";
if (_status.TransferInProgress)
......@@ -155,5 +156,24 @@ namespace ATXTray
"Service stopped.", ToolTipIcon.Error);
}
}
private void UpdateSvcSuspended() {
if (_svcSuspended == _status.ServiceSuspended)
return;
_statusChanged = true;
_svcSuspended = _status.ServiceSuspended;
if (_svcSuspended) {
_miSvcSuspended.Text = @"Service suspended, reason: " + _status.LimitReason;
_miSvcSuspended.BackColor = Color.LightYellow;
_notifyIcon.ShowBalloonTip(500, "AutoTx Monitor",
"Service suspended: " + _status.LimitReason, ToolTipIcon.Warning);
} else {
_miSvcSuspended.Text = @"No limits apply, service active.";
_miSvcSuspended.BackColor = Color.LightGreen;
_notifyIcon.ShowBalloonTip(500, "AutoTx Monitor",
"Service resumed, no limits apply.", ToolTipIcon.Info);
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment