Exemple #1
0
        public ChatPage(Irc.IrcClient ircClient, string channel)
        {
            InitializeComponent();


            if (channel.StartsWith("#"))
            {
                foreach (string Friend in App.FriendList)
                {
                    int newFriendIndex = friendList.Children.Add(new FriendItem()
                    {
                        Nickname = Friend
                    });
                    ((FriendItem)friendList.Children[newFriendIndex]).MouseDown += ChatPage_MouseDown;
                }

                this.ircClient = ircClient;
                this.channel   = channel;

                this.ircClient.JoinChannel(channel);
                this.ircClient.ChannelMessage += IrcClient_ChannelMessage;

                this.ircClient.UserJoined  += IrcClient_UserJoined;
                this.ircClient.UserLeft    += IrcClient_UserLeft;
                this.ircClient.UpdateUsers += IrcClient_UpdateUsers;
            }
            else
            {
                ircClient.PrivateMessage += IrcClient_PrivateMessage;
                col.Width = new GridLength(0);
                gridSplitter.Visibility = Visibility.Collapsed;
            }
            App.FriendList.UserAdded   += FriendList_UserAdded;
            App.FriendList.UserRemoved += FriendList_UserRemoved;
        }
Exemple #2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            gr.IsEnabled = false;
            gr.Opacity   = 0.6d;

            c = new Irc.IrcClient("irc.ppy.sh", 6667);
            c.ExceptionThrown += C_ExceptionThrown;


            c.Nick       = textBox.Text;
            c.ServerPass = passwordBox.Password;
            c.Connect();
            c.OnConnect += C_OnConnect;
        }
Exemple #3
0
        public MainWindow(Irc.IrcClient client)
        {
            InitializeComponent();
            c = client;
            c.PrivateMessage += C_PrivateMessage;


            if (Directory.Exists(string.Format("cfg/", c.Nick)))
            {
                UserConfig.Load(string.Format("cfg/{0}.cfg", c.Nick));
            }
            else
            {
                Directory.CreateDirectory("cfg/");
            }
            if ((!File.Exists(string.Format("cfg/{0}.cfg", c.Nick))) || channels == null)
            {
                UserConfig.Channels = channels = new string[] { "#osu", "#lobby" }
            }
            ;

            App.FriendList       = new UserCollection(UserConfig.FriendList);
            App.IgnoreList       = new UserCollection(UserConfig.IgnoreList);
            App.HighlightedWords = new UserCollection(UserConfig.HighlightedWords);

            foreach (var channel in UserConfig.Channels)
            {
                tabControl.Items.Add(new TabItem()
                {
                    Header  = channel,
                    Content = new Controls.ChatPage(c, channel)
                });
            }
            channels = UserConfig.Channels;


            App.FriendList.UserAdded   += FriendList_Changed;
            App.FriendList.UserRemoved += FriendList_Changed;
        }