private void WriteTokens(object sender, IdleScanAnalysis analysis) { var sb = new StringBuilder(DateTime.Now.ToString("HH:mm")).Append("\t"); if (analysis.BusyTokens.Count > 0) { sb.Append(string.Join(", ", analysis.BusyTokens)); } else { sb.Append("-"); } if (analysis.InfoTokens.Count > 0) { sb.Append(" ").Append("[").Append(string.Join(", ", analysis.InfoTokens)).Append("]"); } if (analysis.Error) { sb.Append(" -> ERROR"); } sb.AppendLine(); WriteLog(sb.ToString()); }
private void OnTimerElapsed(object sender, ElapsedEventArgs args) { try { IdleScanAnalysis analysis = new IdleScanAnalysis(this); Scan?.Invoke(this, analysis); try { if (analysis.Busy) { IdleCount = 0; Busy?.Invoke(this, analysis); } else { IdleCount++; Idle?.Invoke(this, analysis); } } catch (Exception e) { EventLog.WriteEntry(e.ToString(), EventLogEntryType.Error, 18); analysis.Error = true; } Eval?.Invoke(this, analysis); } catch (Exception e) { EventLog.WriteEntry(e.ToString(), EventLogEntryType.Error, 19); } }