public void DisplayNotification(string message)
{
if (instance.MainForm.InvokeRequired)
{
instance.MainForm.Invoke(new System.Windows.Forms.MethodInvoker(() => DisplayNotification(message)));
return;
}
if (showTimestamps)
{
if(fontSettings.ContainsKey("Timestamp"))
{
var fontSetting = fontSettings["Timestamp"];
textPrinter.ForeColor = fontSetting.ForeColor;
textPrinter.BackColor = fontSetting.BackColor;
textPrinter.Font = fontSetting.Font;
textPrinter.PrintText(DateTime.Now.ToString("[HH:mm] "));
}
else
{
textPrinter.ForeColor = SystemColors.GrayText;
textPrinter.BackColor = Color.Transparent;
textPrinter.Font = Settings.FontSetting.DefaultFont;
textPrinter.PrintText(DateTime.Now.ToString("[HH:mm] "));
}
}
if(fontSettings.ContainsKey("Notification"))
{
var fontSetting = fontSettings["Notification"];
textPrinter.ForeColor = fontSetting.ForeColor;
textPrinter.BackColor = fontSetting.BackColor;
textPrinter.Font = fontSetting.Font;
}
else
{
textPrinter.ForeColor = Color.DarkCyan;
textPrinter.BackColor = Color.Transparent;
textPrinter.Font = Settings.FontSetting.DefaultFont;
}
instance.LogClientMessage(sessionName + ".txt", message);
textPrinter.PrintTextLine(message);
}