Example #1
0
        public int CompareTo(object obj)
        {
            if (obj is ChannelMenuItem)
            {
                ChannelMenuItem chItem = obj as ChannelMenuItem;
                Channel         ch1    = m_channel;
                Channel         ch2    = chItem.Channel;

                // ハイライト優先
                if (SettingManager.Data.QuickSwitchHilightsSort)
                {
                    if ((this.Checked && ch1.IsSortTarget) && !(chItem.Checked && ch2.IsSortTarget))
                    {
                        return(1);
                    }
                    else if (!(this.Checked && ch1.IsSortTarget) && (chItem.Checked && ch2.IsSortTarget))
                    {
                        return(-1);
                    }
                }
                // 未読数優先
                if (SettingManager.Data.QuickSwitchUnreadCountSort)
                {
                    int count1 = ch1.IsSortTarget ? ch1.UnreadCount : 0;
                    int count2 = ch2.IsSortTarget ? ch2.UnreadCount : 0;
                    int dx     = count1.CompareTo(count2);
                    if (dx != 0)
                    {
                        return(dx);
                    }
                }
                return(chItem.Index.CompareTo(this.Index));
            }
            else
            {
                return(0);
            }
        }
Example #2
0
        /// <summary>
        /// �`�����l����lj�����
        /// </summary>
        /// <param name="name">�lj�����`�����l����</param>
        /// <param name="defaultChannel">�f�t�H���g�`�����l�����ǂ���</param>
        /// <param name="password">�p�X���[�h</param>
        /// <returns>�lj����ꂽ�`�����l��</returns>
        internal Channel AddChannel(string name, bool defaultChannel, string password, bool isSortTarget)
        {
            // �󕶎���Ȃ甲����
            if (string.IsNullOrEmpty(name.Trim()))
            {
                return null;
            }

            // ��؂������悤�Ƃ��ꂽ�ꍇ�͔�����
            if (name == "-")
            {
                return null;
            }

            // ���ɑ��݂��Ă���A���̃`�����l����Ԃ�
            if (m_channel.ContainsKey(name))
            {
                return m_channel[name];
            }

            Channel channel = new Channel(name, defaultChannel, password, isSortTarget); // �`�����l����쐬
            m_channel.Add(name, channel);                        // ���X�g�ɒlj�

            // ���j���[�ւ̒lj��p
            ChannelMenuItem menu;

            // �`�����l���ꗗ���j���[�ɒlj�
            menu = new ChannelMenuItem(channel);
            menu.Click += new EventHandler(menuChannelListChannelsMenuItem_Click);
            menuChannelListMenuItem.MenuItems.Add(menu); // ���j���[�ɒlj�

            // �|�b�v�A�b�v���j���[�ɒlj�
            menu = new ChannelMenuItem(channel);
            menu.Click += new EventHandler(menuChannelListChannelsMenuItem_Click);
            m_channelPopupMenus.Add(menu);
            return channel;
        }
Example #3
0
        /// <summary>
        /// �w�肳�ꂽ�`�����l���ł̃n�C���C�g��Z�b�g���܂�
        /// </summary>
        /// <param name="channel">�n�C���C�g����`�����l��</param>
        private void SetHighlight(Channel channel, string sender, string message)
        {
            highlightFlag = true;
            highlightChannel = channel;

            string formattedMessage = string.Format(Resources.PrivmsgLogFormat, sender, message);

            // �n�C���C�g���b�Z�[�W�ꗗ�ɒlj�
            ChannelMenuItem mesMenu = new ChannelMenuItem(channel);
            mesMenu.Text = formattedMessage;
            mesMenu.Click += new EventHandler(menuChannelListChannelsMenuItem_Click);
            menuHighlightedMessages.MenuItems.Add(mesMenu);

            AddLog(m_highlightsCh, string.Format(Resources.WholePrivmsgLogFormat, channel.Name, sender, message));

            // �Y���`�����l����n�C���C�g�`�F�b�N����
            foreach (ChannelMenuItem menu in m_channelPopupMenus)
            {
                if (menu.Channel == channel)
                {
                    menu.Checked = true;
                    break;
                }
            }

            // �g�[�X�g
            if (SettingManager.Data.HighlightToast)
            {
                if (m_toastQueue == null)
                {
                    m_toastQueue = new Queue<ToastItem>();
                }

                lock (notification)
                {
                    if (notification.Visible)
                    {
                        m_toastQueue.Enqueue(new ToastItem() { Caption = channel.Name, Text = formattedMessage });
                    }
                    else
                    {
                        notification.Caption = channel.Name;
                        notification.Text = formattedMessage;
                        notification.Visible = true;
                    }
                }
            }

            if (!m_storeFlag) DoHighlight();
        }