Example #1
0
        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);
        }
Example #2
0
        public void DisplayNotification(string message)
        {
            if (instance.MainForm.InvokeRequired)
            {
                instance.MainForm.Invoke(new System.Windows.Forms.MethodInvoker(() => DisplayNotification(message)));
                return;
            }

            if (showTimestamps)
            {
                textPrinter.ForeColor = SystemColors.GrayText;
                textPrinter.PrintText(DateTime.Now.ToString("[HH:mm] "));
            }

            textPrinter.ForeColor = Color.DarkCyan;
            instance.LogClientMessage(sessionName + ".txt", message);
            textPrinter.PrintTextLine(message);
        }
        public void ProcessBufferItem(ChatBufferItem item, bool addToBuffer)
        {
            if (ChatLineAdded != null)
            {
                ChatLineAdded(this, new ChatLineAddedArgs(item));
            }

            lock (SyncChat)
            {
                instance.LogClientMessage("chat.txt", item.From + item.Text);
                if (addToBuffer)
                {
                    textBuffer.Add(item);
                }

                if (showTimestamps)
                {
                    if (fontSettings.ContainsKey("Timestamp"))
                    {
                        var fontSetting = fontSettings["Timestamp"];
                        textPrinter.ForeColor = fontSetting.ForeColor;
                        textPrinter.BackColor = fontSetting.BackColor;
                        textPrinter.Font      = fontSetting.Font;
                        textPrinter.PrintText(item.Timestamp.ToString("[HH:mm] "));
                    }
                    else
                    {
                        textPrinter.ForeColor = SystemColors.GrayText;
                        textPrinter.BackColor = Color.Transparent;
                        textPrinter.Font      = Settings.FontSetting.DefaultFont;
                        textPrinter.PrintText(item.Timestamp.ToString("[HH:mm] "));
                    }
                }

                if (fontSettings.ContainsKey("Name"))
                {
                    var fontSetting = fontSettings["Name"];
                    textPrinter.ForeColor = fontSetting.ForeColor;
                    textPrinter.BackColor = fontSetting.BackColor;
                    textPrinter.Font      = fontSetting.Font;
                }
                else
                {
                    textPrinter.ForeColor = SystemColors.WindowText;
                    textPrinter.BackColor = Color.Transparent;
                    textPrinter.Font      = Settings.FontSetting.DefaultFont;
                }

                if (item.Style == ChatBufferTextStyle.Normal && item.ID != UUID.Zero && instance.GlobalSettings["av_name_link"])
                {
                    textPrinter.InsertLink(item.From, string.Format("secondlife:///app/agent/{0}/about", item.ID));
                }
                else
                {
                    textPrinter.PrintText(item.From);
                }

                if (fontSettings.ContainsKey(item.Style.ToString()))
                {
                    var fontSetting = fontSettings[item.Style.ToString()];
                    textPrinter.ForeColor = fontSetting.ForeColor;
                    textPrinter.BackColor = fontSetting.BackColor;
                    textPrinter.Font      = fontSetting.Font;
                }
                else
                {
                    textPrinter.ForeColor = SystemColors.WindowText;
                    textPrinter.BackColor = Color.Transparent;
                    textPrinter.Font      = Settings.FontSetting.DefaultFont;
                }
                textPrinter.PrintTextLine(item.Text);
            }
        }
Example #4
0
        public void ProcessBufferItem(ChatBufferItem item, bool addToBuffer)
        {
            if (ChatLineAdded != null)
            {
                ChatLineAdded(this, new ChatLineAddedArgs(item));
            }

            lock (SyncChat)
            {
                instance.LogClientMessage("chat.txt", item.From + item.Text);
                if (addToBuffer)
                {
                    textBuffer.Add(item);
                }

                if (showTimestamps)
                {
                    textPrinter.ForeColor = SystemColors.GrayText;
                    textPrinter.PrintText(item.Timestamp.ToString("[HH:mm] "));
                }

                switch (item.Style)
                {
                case ChatBufferTextStyle.Normal:
                    textPrinter.ForeColor = SystemColors.WindowText;
                    break;

                case ChatBufferTextStyle.StatusBlue:
                    textPrinter.ForeColor = Color.Blue;
                    break;

                case ChatBufferTextStyle.StatusDarkBlue:
                    textPrinter.ForeColor = Color.DarkBlue;
                    break;

                case ChatBufferTextStyle.LindenChat:
                    textPrinter.ForeColor = Color.DarkGreen;
                    break;

                case ChatBufferTextStyle.ObjectChat:
                    textPrinter.ForeColor = Color.DarkCyan;
                    break;

                case ChatBufferTextStyle.StartupTitle:
                    textPrinter.ForeColor = SystemColors.WindowText;
                    textPrinter.Font      = new Font(textPrinter.Font, FontStyle.Bold);
                    break;

                case ChatBufferTextStyle.Alert:
                    textPrinter.ForeColor = Color.DarkRed;
                    break;

                case ChatBufferTextStyle.Error:
                    textPrinter.ForeColor = Color.Red;
                    break;

                case ChatBufferTextStyle.OwnerSay:
                    textPrinter.ForeColor = Color.FromArgb(255, 180, 150, 0);
                    break;
                }

                if (item.Style == ChatBufferTextStyle.Normal && item.ID != UUID.Zero && instance.GlobalSettings["av_name_link"])
                {
                    textPrinter.InsertLink(item.From, string.Format("secondlife:///app/agent/{0}/about", item.ID));
                    textPrinter.PrintTextLine(item.Text);
                }
                else
                {
                    textPrinter.PrintTextLine(item.From + item.Text);
                }
            }
        }