public NotificationPopup(ChatSubjects subject, string Message)
 {
     InitializeComponent();
     Subject = subject;
     NotificationTypeLabel.Content = Client.TitleCaseString(Enum.GetName(typeof(ChatSubjects), subject).Replace("_", " "));
     NotificationTextBox.Text = Message;
 }
        public NotificationPopup(ChatSubjects subject, Message Message)
        {
            InitializeComponent();
            Subject = subject;
            MessageData = Message;
            NotificationTypeLabel.Content = Client.TitleCaseString(Enum.GetName(typeof(ChatSubjects), subject).Replace("_", " "));

            //TODO: Get name from id
            ChatPlayerItem Player = Client.AllPlayers[Message.From.User];
            using (XmlReader reader = XmlReader.Create(new StringReader(Message.Body)))
            {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        #region Parse Popup

                        switch (reader.Name)
                        {
                            case "inviteId":
                                reader.Read();
                                InviteId = Convert.ToInt32(reader.Value);
                                break;
                            case "profileIconId":
                                reader.Read();
                                ProfileIconId = Convert.ToInt32(reader.Value);
                                break;
                            case "gameType":
                                reader.Read();
                                GameType = reader.Value;
                                break;
                            case "mapId":
                                reader.Read();
                                MapId = Convert.ToInt32(reader.Value);
                                break;
                            case "queueId":
                                reader.Read();
                                QueueId = Convert.ToInt32(reader.Value);
                                break;
                            case "gameId":
                                reader.Read();
                                GameId = Convert.ToInt32(reader.Value);
                                break;
                        }

                        #endregion Parse Popup
                    }
                }
            }

            var uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", ProfileIconId + ".png");
            ProfileImage.Source = Client.GetImage(uriSource);

            NotificationTextBox.Text = Player.Username + " has invited you to a game" + Environment.NewLine
                                     + "Hosted on " + BaseMap.GetMap(MapId).DisplayName + Environment.NewLine
                                     + "Game Type: " + Client.TitleCaseString(GameType).Replace("_", " ") + Environment.NewLine;
        }
        public FriendInvite(ChatSubjects subject, agsXMPP.protocol.client.Presence message)
        {
            InitializeComponent();
            if (subject == ChatSubjects.XMPP_SUBSCRIBE)
            {
                jid = message.From;
                Client.Log(jid.Bare);
                load(message);
            }

        }
        public NotificationPopup(ChatSubjects subject, Message Message)
        {
            InitializeComponent();
            Subject     = subject;
            MessageData = Message;
            NotificationTypeLabel.Content = Client.TitleCaseString(Enum.GetName(typeof(ChatSubjects), subject).Replace("_", " "));

            //TODO: Get name from id
            ChatPlayerItem Player = Client.AllPlayers[Message.From.User];

            using (XmlReader reader = XmlReader.Create(new StringReader(Message.Body)))
            {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        #region Parse Popup

                        switch (reader.Name)
                        {
                        case "inviteId":
                            reader.Read();
                            InviteId = Convert.ToInt32(reader.Value);
                            break;

                        case "profileIconId":
                            reader.Read();
                            ProfileIconId = Convert.ToInt32(reader.Value);
                            break;

                        case "gameType":
                            reader.Read();
                            GameType = reader.Value;
                            break;

                        case "mapId":
                            reader.Read();
                            MapId = Convert.ToInt32(reader.Value);
                            break;

                        case "queueId":
                            reader.Read();
                            QueueId = Convert.ToInt32(reader.Value);
                            break;

                        case "gameId":
                            reader.Read();
                            GameId = Convert.ToInt32(reader.Value);
                            break;
                        }

                        #endregion Parse Popup
                    }
                }
            }

            var uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", ProfileIconId + ".png");
            ProfileImage.Source = Client.GetImage(uriSource);

            NotificationTextBox.Text = Player.Username + " has invited you to a game" + Environment.NewLine
                                       + "Hosted on " + BaseMap.GetMap(MapId).DisplayName + Environment.NewLine
                                       + "Game Type: " + Client.TitleCaseString(GameType).Replace("_", " ") + Environment.NewLine;
        }
示例#5
0
 internal static void Message(string To, string Message, ChatSubjects Subject)
 {
     Message msg = new Message(ChatClient.Document);
     msg.Type = MessageType.normal;
     msg.To = To + "@pvp.net";
     msg.Subject = ((ChatSubjects)Subject).ToString();
     msg.Body = Message;
     ChatClient.Write(msg);
 }
示例#6
0
        internal static void Message(string To, string Message, ChatSubjects Subject)
        {
            var msg = new Message(new Jid(To + "@pvp.net"))
            {
                Type = MessageType.normal,
                Subject = Subject.ToString(),
                Body = Message
            };

            XmppConnection.Send(msg);
        }
        public NotificationPopup(ChatSubjects subject, Message message)
        {
            InitializeComponent();
            _subject     = subject;
            _messageData = message;
            string name = Enum.GetName(typeof(ChatSubjects), subject);

            if (name != null)
            {
                NotificationTypeLabel.Content =
                    Client.TitleCaseString(name.Replace("_", " "));
            }

            //TODO: Get name from id
            if (Client.AllPlayers.ContainsKey(message.From.User))
            {
                ChatPlayerItem player = Client.AllPlayers[message.From.User];
                using (XmlReader reader = XmlReader.Create(new StringReader(message.Body)))
                {
                    while (reader.Read())
                    {
                        if (!reader.IsStartElement())
                        {
                            continue;
                        }

                        #region Parse Popup

                        switch (reader.Name)
                        {
                        case "inviteId":
                            reader.Read();
                            _inviteId = Convert.ToInt32(reader.Value);
                            break;

                        case "profileIconId":
                            reader.Read();
                            _profileIconId = Convert.ToInt32(reader.Value);
                            break;

                        case "gameType":
                            reader.Read();
                            _gameType = reader.Value;
                            break;

                        case "mapId":
                            reader.Read();
                            _mapId = Convert.ToInt32(reader.Value);
                            break;

                        case "queueId":
                            reader.Read();
                            _queueId = Convert.ToInt32(reader.Value);
                            break;

                        case "gameId":
                            reader.Read();
                            _gameId = Convert.ToInt32(reader.Value);
                            break;
                        }

                        #endregion Parse Popup
                    }
                }

                string uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", _profileIconId + ".png");
                ProfileImage.Source = Client.GetImage(uriSource);

                NotificationTextBox.Text = player.Username + " has invited you to a game" + Environment.NewLine
                                           + "Hosted on " + BaseMap.GetMap(_mapId).DisplayName + Environment.NewLine
                                           + "Game Type: " + Client.TitleCaseString(_gameType).Replace("_", " ") +
                                           Environment.NewLine;
            }
        }
示例#8
0
        public NotificationPopup(ChatSubjects subject, agsXMPP.protocol.client.Message message)
        {
            InitializeComponent();
            _subject     = subject;
            _messageData = message;
            var name = Enum.GetName(typeof(ChatSubjects), subject);

            if (name != null)
            {
                NotificationTypeLabel.Content =
                    Client.TitleCaseString(name.Replace("_", " "));
            }

            //TODO: Get name from id
            if (!Client.AllPlayers.ContainsKey(message.From.User))
            {
                return;
            }

            var player = Client.AllPlayers[message.From.User];

            using (var reader = XmlReader.Create(new StringReader(message.Body)))
            {
                while (reader.Read())
                {
                    if (!reader.IsStartElement())
                    {
                        continue;
                    }

                    #region Parse Popup

                    switch (reader.Name)
                    {
                    case "inviteId":
                        reader.Read();
                        _inviteId = Convert.ToInt32(reader.Value);
                        break;

                    case "profileIconId":
                        reader.Read();
                        _profileIconId = Convert.ToInt32(reader.Value);
                        break;

                    case "gameType":
                        reader.Read();
                        _gameType = reader.Value;
                        break;

                    case "mapId":
                        reader.Read();
                        _mapId = Convert.ToInt32(reader.Value);
                        break;

                    case "queueId":
                        reader.Read();
                        _queueId = Convert.ToInt32(reader.Value);
                        break;

                    case "gameId":
                        reader.Read();
                        _gameId = Convert.ToInt32(reader.Value);
                        break;

                    case "teamName":
                        reader.Read();
                        _teamName = reader.Value;
                        break;

                    case "teamId":
                        reader.Read();
                        _teamId = reader.Value;
                        break;

                    case "msgType":
                        reader.Read();
                        _msgType = reader.Value;
                        break;
                    }

                    #endregion Parse Popup
                }
            }

            var UriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", _profileIconId + ".png");
            ProfileImage.Source = Client.GetImage(UriSource);

            if (name == "RANKED_TEAM_UPDATE")
            {
                switch (_msgType)
                {
                case "invited":
                    NotificationTextBox.Text = player.Username + " has invited you to a Ranked Team" + Environment.NewLine + "Team Name: " + _teamName + Environment.NewLine;
                    break;

                case "kicked":
                    NotificationTextBox.Text = "You have been kicked from a ranked team " + _teamName + ".";
                    break;

                default:
                    NotificationTextBox.Text = "Unhandled msgType in NotificationPopup: " + _msgType + Environment.NewLine + "Please create an issue on github.";
                    break;
                }
            }
            else
            {
                NotificationTextBox.Text = player.Username + " has invited you to a game" + Environment.NewLine
                                           + "Hosted on " + BaseMap.GetMap(_mapId).DisplayName + Environment.NewLine
                                           + "Game Type: " + Client.TitleCaseString(_gameType).Replace("_", " ") +
                                           Environment.NewLine;
            }

            if (!string.IsNullOrWhiteSpace(_msgType) && _msgType != "invited")
            {
                AcceptButton.Visibility  = Visibility.Hidden;
                DeclineButton.Visibility = Visibility.Hidden;
            }
        }
        public NotificationPopup(ChatSubjects subject, agsXMPP.protocol.client.Message message)
        {
            InitializeComponent();
            _subject = subject;
            _messageData = message;
            var name = Enum.GetName(typeof(ChatSubjects), subject);
            if (name != null)
                NotificationTypeLabel.Content =
                    Client.TitleCaseString(name.Replace("_", " "));

            //TODO: Get name from id
            if (!Client.AllPlayers.ContainsKey(message.From.User))
                return;

            var player = Client.AllPlayers[message.From.User];
            using (var reader = XmlReader.Create(new StringReader(message.Body)))
            {
                while (reader.Read())
                {
                    if (!reader.IsStartElement())
                        continue;

                    #region Parse Popup

                    switch (reader.Name)
                    {
                        case "inviteId":
                            reader.Read();
                            _inviteId = Convert.ToInt32(reader.Value);
                            break;
                        case "profileIconId":
                            reader.Read();
                            _profileIconId = Convert.ToInt32(reader.Value);
                            break;
                        case "gameType":
                            reader.Read();
                            _gameType = reader.Value;
                            break;
                        case "mapId":
                            reader.Read();
                            _mapId = Convert.ToInt32(reader.Value);
                            break;
                        case "queueId":
                            reader.Read();
                            _queueId = Convert.ToInt32(reader.Value);
                            break;
                        case "gameId":
                            reader.Read();
                            _gameId = Convert.ToInt32(reader.Value);
                            break;
                        case "teamName":
                            reader.Read();
                            _teamName = reader.Value;
                            break;
                        case "teamId":
                            reader.Read();
                            _teamId = reader.Value;
                            break;
                        case "msgType":
                            reader.Read();
                            _msgType = reader.Value;
                            break;
                    }

                    #endregion Parse Popup
                }
            }

            var UriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", _profileIconId + ".png");
            ProfileImage.Source = Client.GetImage(UriSource);

            if (name == "RANKED_TEAM_UPDATE")
            {
                switch (_msgType)
                {
                    case "invited":
                        NotificationTextBox.Text = player.Username + " has invited you to a Ranked Team" + Environment.NewLine + "Team Name: " + _teamName + Environment.NewLine;
                        break;
                    case "kicked":
                        NotificationTextBox.Text = "You have been kicked from a ranked team " + _teamName + ".";
                        break;
                    default:
                        NotificationTextBox.Text = "Unhandled msgType in NotificationPopup: " + _msgType + Environment.NewLine + "Please create an issue on github.";
                        break;
                }
            }
            else
            {
                NotificationTextBox.Text = player.Username + " has invited you to a game" + Environment.NewLine
                                           + "Hosted on " + BaseMap.GetMap(_mapId).DisplayName + Environment.NewLine
                                           + "Game Type: " + Client.TitleCaseString(_gameType).Replace("_", " ") +
                                           Environment.NewLine;
            }

            if (!string.IsNullOrWhiteSpace(_msgType) && _msgType != "invited")
            {
                AcceptButton.Visibility = Visibility.Hidden;
                DeclineButton.Visibility = Visibility.Hidden;
            }
        }
        public NotificationPopup(ChatSubjects subject, string message)
        {
            InitializeComponent();
            _subject = subject;
            var name = Enum.GetName(typeof(ChatSubjects), subject);
            if (name != null)
                NotificationTypeLabel.Content =
                    Client.TitleCaseString(name.Replace("_", " "));

            NotificationTextBox.Text = message;
        }
        private async void Client_OnMessage(object sender, Message msg)
        {
            if (msg.Subject != null)
            {
                ChatSubjects subject = (ChatSubjects)Enum.Parse(typeof(ChatSubjects), msg.Subject, true);
                double[]     Double  = new double[1] {
                    Convert.ToDouble(msg.From.User.Replace("sum", ""))
                };
                string[] Name = await RiotCalls.GetSummonerNames(Double);

                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    InvitePlayer invitePlayer = null;
                    foreach (var x in Client.InviteListView.Items)
                    {
                        InvitePlayer tempInvPlayer = (InvitePlayer)x;
                        if ((string)tempInvPlayer.PlayerLabel.Content == Name[0])
                        {
                            invitePlayer = x as InvitePlayer;
                            break;
                        }
                    }

                    if (subject == ChatSubjects.GAME_INVITE_ACCEPT)
                    {
                        if (invitePlayer != null)
                        {
                            invitePlayer.StatusLabel.Content = "Accepted";
                        }
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_REJECT)
                    {
                        if (invitePlayer != null)
                        {
                            invitePlayer.StatusLabel.Content = "Rejected";
                        }
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_LIST_STATUS)
                    {
                        ParseCurrentInvitees(msg.Body);
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_ALLOW_SUGGESTIONS)
                    {
                        InviteButton.IsEnabled = true;
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_DISALLOW_SUGGESTIONS)
                    {
                        InviteButton.IsEnabled = false;
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_OWNER_CANCEL)
                    {
                        MessageOverlay messageOver       = new MessageOverlay();
                        messageOver.MessageTitle.Content = "Party Cancelled";
                        messageOver.MessageTextBox.Text  = "This party has been cancelled.";
                        newRoom.Leave("Party Cancelled");
                        Client.OverlayContainer.Content    = messageOver.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_CANCEL)
                    {
                        MessageOverlay messageOver       = new MessageOverlay();
                        messageOver.MessageTitle.Content = "Kicked";
                        messageOver.MessageTextBox.Text  = "You have been kicked from the party.";
                        newRoom.Leave("Kicked");
                        Client.OverlayContainer.Content    = messageOver.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;
                    }
                    else if (subject == ChatSubjects.VERIFY_INVITEE)
                    {
                        Client.Message(MessageData.From.User, MessageData.Body, ChatSubjects.VERIFY_INVITEE_ACK);
                    }
                }));
            }
        }