示例#1
0
文件: fIRC.cs 项目: lpradel/lpIRC
        public fIRC(IRCServer pServer, IRCLogInDetails pLogin)
        {
            InitializeComponent();

            // set window-title
            this.Text = pServer.Address;

            // plug-in to connection via event-handlers
            connection.Connected += new EventHandler(ConnectionConnected);
            connection.ConnectionClosed += new EventHandler(ConnectionDisconnected);
            connection.GotMessage += new IRCConnection.MessageEventHandler(ConnectionGotMessage);
            connection.SentMessage += new IRCConnection.MessageEventHandler(ConnectionSentMessage);
            connection.NickChanged += new EventHandler(ConnectionNickChanged);
            connection.ConnectionSocketError += new ClientSocket.ExceptionEventHandler(ConnectionError);

            // setup
            server = pServer;
            login = pLogin;

            // build IRCManager
            manager = new IRCManager(connection, server, login);

            // plug-in to manager via event-handlers
            manager.JoinedChannel += new IRCManager.ChannelEventHandler(ManagerJoinedChannel);
            manager.LeftChannel += new IRCManager.ChannelEventHandler(ManagerLeftChannel);
            manager.KickedFromChannel += new IRCManager.ChannelEventHandler(ManagerKickedFromChannel);
            manager.GotPrivateMessage += new IRCConnection.MessageEventHandler(ManagerGotPrivateMessage);

            // connect to server
            manager.Connect();
        }
示例#2
0
文件: fChannel.cs 项目: lpradel/lpIRC
        public fChannel(IRCChannel pChannel, IRCManager pManager)
        {
            InitializeComponent();

            // plug into Manager from KickedFromChannel
            manager = pManager;
            managerKickedFromChannel = new IRCManager.ChannelEventHandler(ManagerKickedFromChannel);
            pManager.KickedFromChannel += managerKickedFromChannel;

            // setup
            SetChannel(pChannel);
        }
示例#3
0
文件: fChannel.cs 项目: lpradel/lpIRC
        private void ManagerKickedFromChannel(object sender, IRCManager.ChannelEventArgs e)
        {
            if (InvokeRequired)
            {
                Invoke(new Action(delegate { ManagerKickedFromChannel(sender, e); }));
                return;
            }

            if (e.Channel.ChannelName.ToLower().Equals(channel.ChannelName.ToLower()))
            {   // we were kicked from the channel
                // perform cleanup
                DisposeChannelEventHandlers();
                if (isJoined)
                {
                    channel.Dispose();
                }
                isJoined = false;
                this.Close();
            }
        }
示例#4
0
文件: fIRC.cs 项目: lpradel/lpIRC
        private void ManagerLeftChannel(object sender, IRCManager.ChannelEventArgs e)
        {
            if (InvokeRequired)
            {
                Invoke(new Action(delegate { ManagerLeftChannel(sender, e); }));
                return;
            }

            fIRCChannels.Items.Remove(e.Channel);
            Log("You have left the " + e.Channel.ChannelName + " channel!", Color.DarkRed);
        }
示例#5
0
文件: fIRC.cs 项目: lpradel/lpIRC
        private void ManagerJoinedChannel(object sender, IRCManager.ChannelEventArgs e)
        {
            if (InvokeRequired)
            {
                Invoke(new Action(delegate { ManagerJoinedChannel(sender, e); }));
                return;
            }

            // setup channel-frame
            fChannel wndChannel = new fChannel(e.Channel, manager);
            Form mdiParent = this.MdiParent;
            wndChannel.MdiParent = mdiParent;
            wndChannel.Show();

            Log("You have joined the " + e.Channel.ChannelName + " channel!", Color.DarkRed);

            // update channels-list
            if (!fIRCChannels.Items.Contains(e.Channel))
            {
                fIRCChannels.Items.Add(e.Channel);
            }
            // todo: fix
            // e.Channel.TopicChanged += new IRCConnection.MessageEventHandler(ChannelTopicChanged);
        }