Exemple #1
0
        public static void OnChatCallBack(string send, string content)
        {
            Application.Current.Dispatcher.Invoke(
                DispatcherPriority.Normal, (Action) delegate
            {
                Console.WriteLine(content);



                #region unicodeList

                List <string> unicodes = new List <string>()
                {
                    "\u00030\u0003",
                    "\u00031\u0003",
                    "\u00032\u0003",
                    "\u00033\u0003",
                    "\u00034\u0003",
                    "\u00035\u0003",
                    "\u00036\u0003",
                    "\u00036\u0003",
                    "\u00038\u0003",
                    "\u00039\u0003",
                };

                #endregion

                if (content.Length > 60)
                {
                    int l   = content.Length / 2;
                    content = content.Substring(0, l) + Environment.NewLine +
                              content.Substring(l, content.Length - l);
                }

                string[] c = content.Split(new string[] { "\u0003" }, StringSplitOptions.None);
                content    = c[0];

                ((MainWindow)Application.Current.MainWindow).ListChat.Items.Add(new TemplateListViewChat()
                {
                    Yuser    = send,
                    Ycontent = content
                });

                #region games

                if (!content.StartsWith(".clear"))
                {
                    TemplateListViewChat t = new TemplateListViewChat()
                    {
                        Yuser    = send,
                        Ycontent = content
                    };
                    OnCallCheckGames(send + @" " + t.Ycontent);
                }

                #endregion

                // auto scroll
                if (((MainWindow)Application.Current.MainWindow).ChkAutoScroll != null &&
                    ((MainWindow)Application.Current.MainWindow).ChkAutoScroll.IsChecked.Value)
                {
                    ((MainWindow)Application.Current.MainWindow).ListChat.ScrollIntoView(
                        ((MainWindow)Application.Current.MainWindow).ListChat.Items[
                            ((MainWindow)Application.Current.MainWindow).ListChat.Items.Count - 1]
                        );
                }

                OnCallEventFlood(send);
            });
        }
Exemple #2
0
        public static void OnChatCallBack(string send, string content)
        {

            Application.Current.Dispatcher.Invoke(
                DispatcherPriority.Normal, (Action) delegate
                {
                    Console.WriteLine(content);



                    #region unicodeList

                    List<string> unicodes = new List<string>()
                    {
                        "\u00030\u0003",
                        "\u00031\u0003",
                        "\u00032\u0003",
                        "\u00033\u0003",
                        "\u00034\u0003",
                        "\u00035\u0003",
                        "\u00036\u0003",
                        "\u00036\u0003",
                        "\u00038\u0003",
                        "\u00039\u0003",

                    };

                    #endregion

                    if (content.Length > 60)
                    {
                        int l = content.Length/2;
                        content = content.Substring(0, l) + Environment.NewLine +
                                  content.Substring(l, content.Length - l);
                    }

                    string[] c = content.Split(new string[] {"\u0003"}, StringSplitOptions.None);
                    content = c[0];

                    ((MainWindow) Application.Current.MainWindow).ListChat.Items.Add(new TemplateListViewChat()
                    {
                        Yuser = send,
                        Ycontent = content
                    });

                    #region games

                    if (!content.StartsWith(".clear"))
                    {
                        TemplateListViewChat t = new TemplateListViewChat()
                        {
                            Yuser = send,
                            Ycontent = content
                        };
                        OnCallCheckGames(send + @" " + t.Ycontent);
                    }

                    #endregion

                    // auto scroll
                    if (((MainWindow) Application.Current.MainWindow).ChkAutoScroll != null &&
                        ((MainWindow) Application.Current.MainWindow).ChkAutoScroll.IsChecked.Value)
                    {
                        ((MainWindow) Application.Current.MainWindow).ListChat.ScrollIntoView(
                            ((MainWindow) Application.Current.MainWindow).ListChat.Items[
                                ((MainWindow) Application.Current.MainWindow).ListChat.Items.Count - 1]
                            );
                    }

                    OnCallEventFlood(send);

                });
        }