当前位置: 首页>>代码示例>>C#>>正文


C# IrcClient.Join方法代码示例

本文整理汇总了C#中IrcClient.Join方法的典型用法代码示例。如果您正苦于以下问题:C# IrcClient.Join方法的具体用法?C# IrcClient.Join怎么用?C# IrcClient.Join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IrcClient的用法示例。


在下文中一共展示了IrcClient.Join方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: menuItemConnect_Click

        private void menuItemConnect_Click(object sender, System.EventArgs e)
        {
            try
            {
                AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- Attempting connection to " + User.server + ":" + User.port.ToString() + "\n");

                if (File.Exists("ignore"))
                {
                    using (StreamReader sr = new StreamReader("ignore"))
                    {
                        string line = null;

                        while ((line = sr.ReadLine()) != null)
                        {
                            alIgnoredHosts.Add(line.ToString());
                        }
                    }
                }

                irc = new IrcClient();
                irc.SendDelay = 200;
                irc.AutoRetry = false;
                irc.ChannelSyncing = true;

                irc.OnTopic += new TopicEventHandler(irc_OnTopic);
                irc.OnDisconnected += new SimpleEventHandler(irc_OnDisconnected);
                irc.OnDeop += new DeopEventHandler(irc_OnDeop);
                irc.OnOp += new OpEventHandler(irc_OnOp);
                irc.OnOwner += new OwnerEventHandler(irc_OnOwner);
                irc.OnHalfOp += new HalfOpEventHandler(irc_OnHalfOp);
                irc.OnProtect += new ProtectEventHandler(irc_OnProtect);
                irc.OnDeOwner += new DeOwnerEventHandler(irc_OnDeOwner);
                irc.OnDeHalfOp += new DeHalfOpEventHandler(irc_OnDeHalfOp);
                irc.OnDeProtect += new DeProtectEventHandler(irc_OnDeProtect);
                irc.OnDevoice += new DevoiceEventHandler(irc_OnDevoice);
                irc.OnVoice += new VoiceEventHandler(irc_OnVoice);
                irc.OnWho += new WhoEventHandler(irc_OnWho);
                irc.OnModeChange += new MessageEventHandler(irc_OnModeChange);
                irc.OnUserModeChange += new MessageEventHandler(irc_OnUserModeChange);
                irc.OnUnban += new UnbanEventHandler(irc_OnUnban);
                irc.OnBan += new BanEventHandler(irc_OnBan);
                irc.OnKick += new KickEventHandler(irc_OnKick);
                irc.OnQueryAction += new ActionEventHandler(irc_OnQueryAction);
                irc.OnQuit += new QuitEventHandler(irc_OnQuit);
                irc.OnNickChange += new NickChangeEventHandler(irc_OnNickChange);
                irc.OnChannelAction += new ActionEventHandler(irc_OnChannelAction);
                irc.OnReadLine += new ReadLineEventHandler(irc_OnReadLine);
                irc.OnJoin += new JoinEventHandler(irc_OnJoin);
                irc.OnPart += new PartEventHandler(irc_OnPart);
                irc.OnQueryNotice += new MessageEventHandler(irc_OnQueryNotice);
                irc.OnChannelMessage += new MessageEventHandler(irc_OnChannelMessage);
                irc.OnQueryMessage += new MessageEventHandler(irc_OnQueryMessage);

                if (irc.Connect(User.server, User.port))
                {
                    irc.Login(User.username, Application.Name + " " + Application.Version);
                    irc.Join(User.channel);

                    if (irc.Connected)
                    {
                        menuItemConnect.Enabled = false;
                        menuItemDisconnect.Enabled = true;

                        threadIrcConnection = new Thread(new ThreadStart(IRCListenThread));
                        threadIrcConnection.Start();
                    }
                    else
                    {
                        AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "[");
                        AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString());
                        AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] ");
                        AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- Unable to connect to " + User.server + ":" + User.port.ToString() + "\n");
                    }
                }
                else
                {
                    AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "[");
                    AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString());
                    AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] ");
                    AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- A connection to " + User.server + ":" + User.port.ToString() + " could not be established.\n");
                }
            }
            catch (Exception ex)
            {
                User.ErrorLog(ex.ToString());
            }
        }
开发者ID:gavinkendall,项目名称:psychat,代码行数:87,代码来源:ChatForm.cs


注:本文中的IrcClient.Join方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。