コード例 #1
0
        private void AddPreviewText(string text, LineType type)
        {
            // InvokeRequired required compares the thread ID of the
            // calling thread to the thread ID of the creating thread.
            // If these threads are different, it returns true.
            if (this.RB_Preview.InvokeRequired)
            {
                SetPreviewTextDelegate d = new SetPreviewTextDelegate(AddPreviewText);
                this.Invoke(d, new object[] { text, type });
            }
            else
            {
                RB_Preview.AppendText(text + "\n");
                RB_Preview.Select(RB_Preview.Text.Length - text.Length - 1, text.Length);

                switch (type)
                {
                case LineType.Generic:
                    RB_Preview.SelectionColor = _programSettings.Colors.LineColorGeneric;
                    break;

                case LineType.IrcCommand:
                    RB_Preview.SelectionColor = _programSettings.Colors.LineColorIrcCommand;
                    break;

                case LineType.ModCommand:
                    RB_Preview.SelectionColor = _programSettings.Colors.LineColorModeration;
                    break;


                case LineType.SoundCommand:
                    RB_Preview.SelectionColor = _programSettings.Colors.LineColorSoundPlayback;
                    break;

                default:
                    RB_Preview.SelectionColor = _programSettings.Colors.LineColorGeneric;
                    break;
                }
            }
        }
コード例 #2
0
        private void AppendChatLine(string text, LineType linetype)
        {
            RB_Preview.AppendText(text + "\n");
            RB_Preview.Select(RB_Preview.Text.Length - text.Length - 1, text.Length);
            switch (linetype)
            {
            case LineType.IrcCommand:
                RB_Preview.SelectionColor = LineColorIrcCommand;
                break;

            case LineType.ModCommand:
                RB_Preview.SelectionColor = LineColorModeration;
                break;

            case LineType.SoundCommand:
                RB_Preview.SelectionColor = LineColorSoundPlayback;
                break;

            default:
                RB_Preview.SelectionColor = LineColorGeneric;
                break;
            }
        }