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

Separate tooltip and progress bar updates in tray.

Refers to #2, #26
parent cdc0e012
No related branches found
No related tags found
No related merge requests found
...@@ -132,8 +132,7 @@ namespace ATxTray ...@@ -132,8 +132,7 @@ namespace ATxTray
_miTxEnqueue.Text = @"+++ Add new directory for transfer. +++"; _miTxEnqueue.Text = @"+++ Add new directory for transfer. +++";
_miTxEnqueue.Click += StartNewTransfer; _miTxEnqueue.Click += StartNewTransfer;
_miTxProgressBar.Text = @"Current Transfer Progress"; _miTxProgressBar.ToolTipText = @"Current Transfer Progress";
_miTxProgressBar.ToolTipText = _miTxProgressBar.Text;
_miTxProgressBar.Value = 0; _miTxProgressBar.Value = 0;
var size = _miTxProgressBar.Size; var size = _miTxProgressBar.Size;
size.Width = 300; size.Width = 300;
...@@ -188,6 +187,7 @@ namespace ATxTray ...@@ -188,6 +187,7 @@ namespace ATxTray
serviceRunning = "OK"; serviceRunning = "OK";
ReadStatus(); ReadStatus();
UpdateSvcSuspended(); UpdateSvcSuspended();
UpdateTxProgressBar();
UpdateTxInProgress(); UpdateTxInProgress();
if ((DateTime.Now - _status.LastStatusUpdate).TotalSeconds < 60) if ((DateTime.Now - _status.LastStatusUpdate).TotalSeconds < 60)
heartBeat = "OK"; heartBeat = "OK";
...@@ -303,14 +303,12 @@ namespace ATxTray ...@@ -303,14 +303,12 @@ namespace ATxTray
private void UpdateTxInProgress() { private void UpdateTxInProgress() {
if (_txInProgress == _status.TransferInProgress && if (_txInProgress == _status.TransferInProgress &&
_txSize == _status.CurrentTransferSize && _txSize == _status.CurrentTransferSize)
_txProgressPct == _status.CurrentTransferPercent)
return; return;
_statusChanged = true; _statusChanged = true;
_txInProgress = _status.TransferInProgress; _txInProgress = _status.TransferInProgress;
_txSize = _status.CurrentTransferSize; _txSize = _status.CurrentTransferSize;
_txProgressPct = _status.CurrentTransferPercent;
if (_txInProgress) { if (_txInProgress) {
_miTxProgress.Text = @"Transfer in progress (size: " + _miTxProgress.Text = @"Transfer in progress (size: " +
Conv.BytesToString(_txSize) + ")"; Conv.BytesToString(_txSize) + ")";
...@@ -318,17 +316,30 @@ namespace ATxTray ...@@ -318,17 +316,30 @@ namespace ATxTray
_notifyIcon.ShowBalloonTip(500, AppTitle, _notifyIcon.ShowBalloonTip(500, AppTitle,
"New transfer started (size: " + "New transfer started (size: " +
Conv.BytesToString(_txSize) + ").", ToolTipIcon.Info); Conv.BytesToString(_txSize) + ").", ToolTipIcon.Info);
Log.Debug("Transfer progress: {0}%", _txProgressPct);
_miTxProgressBar.Visible = true;
_miTxProgressBar.Value = _txProgressPct;
_miTxProgressBar.Text = _txProgressPct.ToString();
} else { } else {
_miTxProgress.Text = @"No transfer running."; _miTxProgress.Text = @"No transfer running.";
_miTxProgress.ResetBackColor(); _miTxProgress.ResetBackColor();
_notifyIcon.ShowBalloonTip(500, AppTitle, _notifyIcon.ShowBalloonTip(500, AppTitle,
"Transfer completed.", ToolTipIcon.Info); "Transfer completed.", ToolTipIcon.Info);
}
}
private void UpdateTxProgressBar() {
if (_txInProgress == _status.TransferInProgress &&
_txProgressPct == _status.CurrentTransferPercent)
return;
_statusChanged = true;
_txProgressPct = _status.CurrentTransferPercent;
if (_txInProgress) {
Log.Debug("Transfer progress: {0}%", _txProgressPct);
_miTxProgressBar.Visible = true;
_miTxProgressBar.Value = _txProgressPct;
_miTxProgressBar.ToolTipText = _txProgressPct.ToString();
} else {
_miTxProgressBar.Value = 0; _miTxProgressBar.Value = 0;
_miTxProgressBar.Visible = false; _miTxProgressBar.Visible = false;
_miTxProgressBar.ToolTipText = @"Current Transfer Progress";
} }
} }
......
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