protected void FireReport(string message) { string reportMsg = string.Format("クラス名:{0}, デバイス名:{1}・・・{2}", this.GetType().Name, _name, message); if (Reported != null) { Reported.Invoke(this, reportMsg); } // C#6(VS2015)以降なら、以下の様に1行で書ける。 // Reported?.Invoke(this, reportMsg); }
private static void Report() { if (ReportOn && GetCurrent() - lastMs > ReportWait) { lastMs = GetCurrent(); sb.AppendLine("Profiler Report =="); foreach (ProfilerData d in Data.Values) { d.Push(); d.Clear(); sb.AppendLine(d.ToString()); } Logger.Log(sb.ToString()); sb.Clear(); Reported?.Invoke(null, Data); } }
protected virtual void OnReported(IAnalysisReport e) { Reported?.Invoke(this, e); }
protected virtual void OnReported() { Reported?.Invoke(this, EventArgs.Empty); }
private void Report(string message, ReportLevel level = ReportLevel.Informational) { Reported?.Invoke(this, new ReportedEventArgs(message, level)); }