コード例 #1
0
        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);
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 protected virtual void OnReported(IAnalysisReport e)
 {
     Reported?.Invoke(this, e);
 }
コード例 #4
0
 protected virtual void OnReported()
 {
     Reported?.Invoke(this, EventArgs.Empty);
 }
コード例 #5
0
 private void Report(string message, ReportLevel level = ReportLevel.Informational)
 {
     Reported?.Invoke(this, new ReportedEventArgs(message, level));
 }