public static void Broadcast(IService source, DateTime time, PowerEvent pe) { foreach (var s in m_Services.Where(s => s != source)) { s.OnMessage(time, pe); } }
public void OnMessage(DateTime time, PowerEvent pe) { if (pe.IsImportant()) { foreach (long sub in m_Subscribers) { try { Bot.SendTextMessageAsync(sub, $"New event : {pe}"); } catch (Exception ex) { Handle(ex); } } } }
public void OnMessage(DateTime time, PowerEvent pe) { m_Lines += 1; if (pe.Event == EventKind.UnknownError) { m_Errors += 1; } string msg = $"{time.ToString("u")} : {pe}"; File.AppendAllText(GetFile(), $"{msg}\n"); Console.WriteLine(msg); m_Last10Rows.Add(msg); if (m_Last10Rows.Count > 10) { m_Last10Rows.RemoveAt(0); } }
public void OnMessage(DateTime time, PowerEvent pe) { }