private async Task RefreshTasktrayIcon()
{
if (_colorize)
await this.Colorize();
if (!TimerRefreshIcon.Enabled) return;
//Static usCheckCnt As int = 0
//Static iconDlListTopItem As ListViewItem = null
//if (((ListView)ListTab.SelectedTab.Tag).TopItem == iconDlListTopItem)
// ((ImageDictionary)this.TIconDic).PauseGetImage = false;
//else
// ((ImageDictionary)this.TIconDic).PauseGetImage = true;
//
//iconDlListTopItem = ((ListView)ListTab.SelectedTab.Tag).TopItem;
iconCnt += 1;
blinkCnt += 1;
//usCheckCnt += 1;
//if (usCheckCnt > 300) //1min
//{
// usCheckCnt = 0;
// if (!this.IsReceivedUserStream)
// {
// TraceOut("ReconnectUserStream");
// tw.ReconnectUserStream();
// }
//}
var busy = this.workerSemaphore.CurrentCount != MAX_WORKER_THREADS;
if (iconCnt >= this.NIconRefresh.Length)
{
iconCnt = 0;
}
if (blinkCnt > 10)
{
blinkCnt = 0;
//未保存の変更を保存
SaveConfigsAll(true);
}
if (busy)
{
NotifyIcon1.Icon = NIconRefresh[iconCnt];
idle = false;
_myStatusError = false;
return;
}
TabModel tb = _statuses.GetTabByType(MyCommon.TabUsageType.Mentions);
if (this._cfgCommon.ReplyIconState != MyCommon.REPLY_ICONSTATE.None && tb != null && tb.UnreadCount > 0)
{
if (blinkCnt > 0) return;
blink = !blink;
if (blink || this._cfgCommon.ReplyIconState == MyCommon.REPLY_ICONSTATE.StaticIcon)
{
NotifyIcon1.Icon = ReplyIcon;
}
else
{
NotifyIcon1.Icon = ReplyIconBlink;
}
idle = false;
return;
}
if (idle) return;
idle = true;
//優先度:エラー→オフライン→アイドル
//エラーは更新アイコンでクリアされる
if (_myStatusError)
{
NotifyIcon1.Icon = NIconAtRed;
return;
}
if (_myStatusOnline)
{
NotifyIcon1.Icon = NIconAt;
}
else
{
NotifyIcon1.Icon = NIconAtSmoke;
}
}