public async void GetPendingInvites() { object[] allInvites = await Client.PVPNet.getPendingInvitations(); foreach (var item in allInvites) { InvitationRequest invite = new InvitationRequest((TypedObject)item); Client.MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { var pop = new GameInvitePopup(invite) { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom, Height = 230 }; Client.NotificationGrid.Children.Add(pop); })); } }
//internal static Inviter CurrentInviter; #pragma warning disable 4014 internal static void OnMessageReceived(object sender, object message) { MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() => { if (message is StoreAccountBalanceNotification) { StoreAccountBalanceNotification newBalance = (StoreAccountBalanceNotification)message; InfoLabel.Content = "IP: " + newBalance.Ip + " ∙ RP: " + newBalance.Rp; Client.LoginPacket.IpBalance = newBalance.Ip; Client.LoginPacket.RpBalance = newBalance.Rp; } else if (message is GameNotification) { GameNotification notification = (GameNotification)message; MessageOverlay messageOver = new MessageOverlay(); messageOver.MessageTitle.Content = notification.Type; switch (notification.Type) { case "PLAYER_BANNED_FROM_GAME": messageOver.MessageTitle.Content = "Banned from custom game"; messageOver.MessageTextBox.Text = "You have been banned from this custom game!"; break; default: messageOver.MessageTextBox.Text = notification.MessageCode + Environment.NewLine; messageOver.MessageTextBox.Text = Convert.ToString(notification.MessageArgument); break; } Client.OverlayContainer.Content = messageOver.Content; Client.OverlayContainer.Visibility = Visibility.Visible; Client.ClearPage(typeof(CustomGameLobbyPage)); if (messageOver.MessageTitle.Content.ToString() != "PLAYER_QUIT") { Client.SwitchPage(new MainPage()); } } else if (message is PVPNetConnect.RiotObjects.Platform.Statistics.EndOfGameStats) { PVPNetConnect.RiotObjects.Platform.Statistics.EndOfGameStats stats = message as PVPNetConnect.RiotObjects.Platform.Statistics.EndOfGameStats; EndOfGamePage EndOfGame = new EndOfGamePage(stats); Client.ClearPage(typeof(TeamQueuePage)); Client.OverlayContainer.Visibility = Visibility.Visible; Client.OverlayContainer.Content = EndOfGame.Content; } else if (message is StoreFulfillmentNotification) { PlayerChampions = await PVPNet.GetAvailableChampions(); } else if (message is Inviter) { Inviter stats = message as Inviter; //CurrentInviter = stats; } else if (message is InvitationRequest) { InvitationRequest stats = message as InvitationRequest; //TypedObject body = (TypedObject)to["body"]; if (stats.Inviter != null) { try { //Already existant popup. Do not create a new one var x = Client.InviteData[stats.InvitationId]; if (x.Inviter != null) { return; } } catch { } MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { GameInvitePopup pop = new GameInvitePopup(stats); pop.HorizontalAlignment = HorizontalAlignment.Right; pop.VerticalAlignment = VerticalAlignment.Bottom; pop.Height = 230; Client.NotificationGrid.Children.Add(pop); })); } } })); }
//internal static Inviter CurrentInviter; internal static void OnMessageReceived(object sender, object message) { MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() => { if (message is StoreAccountBalanceNotification) { StoreAccountBalanceNotification newBalance = (StoreAccountBalanceNotification)message; InfoLabel.Content = "IP: " + newBalance.Ip + " ∙ RP: " + newBalance.Rp; Client.LoginPacket.IpBalance = newBalance.Ip; Client.LoginPacket.RpBalance = newBalance.Rp; } else if (message is GameNotification) { GameNotification notification = (GameNotification)message; MessageOverlay messageOver = new MessageOverlay(); messageOver.MessageTitle.Content = notification.Type; switch (notification.Type) { case "PLAYER_BANNED_FROM_GAME": messageOver.MessageTitle.Content = "Banned from custom game"; messageOver.MessageTextBox.Text = "You have been banned from this custom game!"; break; default: messageOver.MessageTextBox.Text = notification.MessageCode + Environment.NewLine; messageOver.MessageTextBox.Text = Convert.ToString(notification.MessageArgument); break; } Client.OverlayContainer.Content = messageOver.Content; Client.OverlayContainer.Visibility = Visibility.Visible; Client.ClearPage(new CustomGameLobbyPage()); Client.SwitchPage(new MainPage()); } else if (message is EndOfGameStats) { EndOfGameStats stats = message as EndOfGameStats; EndOfGamePage EndOfGame = new EndOfGamePage(stats); Client.OverlayContainer.Visibility = Visibility.Visible; Client.OverlayContainer.Content = EndOfGame.Content; } else if (message is StoreFulfillmentNotification) { PlayerChampions = await PVPNet.GetAvailableChampions(); } else if (message is Inviter) { Inviter stats = message as Inviter; //CurrentInviter = stats; } else if (message is InvitationRequest) { InvitationRequest stats = message as InvitationRequest; Inviter Inviterstats = message as Inviter; //TypedObject body = (TypedObject)to["body"]; MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { //Gameinvite stuff GameInvitePopup pop = new GameInvitePopup(stats); //await Invite.Callback; //Invite.InvitationRequest(body); pop.HorizontalAlignment = HorizontalAlignment.Right; pop.VerticalAlignment = VerticalAlignment.Bottom; pop.Height = 230; Client.NotificationGrid.Children.Add(pop); //Client.InviteJsonRequest = LegendaryClient.Logic.JSON.InvitationRequest.PopulateGameInviteJson(); //message.GetType() == typeof(GameInvitePopup) })); } })); }