private async void Download_Click(object sender, RoutedEventArgs e) { if (User) { PublicSummoner summoner = await RiotCalls.GetSummonerByName(Command.Text); if (string.IsNullOrWhiteSpace(summoner.Name)) { var overlay = new MessageOverlay { MessageTitle = { Content = "No Summoner Found" }, MessageTextBox = { Text = "The summoner \"" + Command.Text + "\" does not exist." } }; Client.OverlayContainer.Content = overlay.Content; Client.OverlayContainer.Visibility = Visibility.Visible; return; } HintLabel.Content = "retrieving replay"; HintLabel.Visibility = Visibility.Visible; var fadeLabelInAnimationx = new DoubleAnimation(1, TimeSpan.FromSeconds(0.1)); HintLabel.BeginAnimation(OpacityProperty, fadeLabelInAnimationx); PlatformGameLifecycleDTO n = await RiotCalls.RetrieveInProgressSpectatorGameInfo(Command.Text); if (n == null) { var overlay = new MessageOverlay { MessageTitle = { Content = "No Game Found" }, MessageTextBox = { Text = "The summoner \"" + Command.Text + "\" is not currently in game." } }; Client.OverlayContainer.Content = overlay.Content; Client.OverlayContainer.Visibility = Visibility.Visible; return; } if (n.GameName != null) { string ip = n.PlayerCredentials.ObserverServerIp + ":" + n.PlayerCredentials.ObserverServerPort; string key = n.PlayerCredentials.ObserverEncryptionKey; var gameId = (int)n.PlayerCredentials.GameId; recorder = new ReplayRecorder(ip, gameId, Client.Region.InternalName, key); recorder.OnReplayRecorded += recorder_OnReplayRecorded; recorder.OnGotChunk += recorder_OnGotChunk; var fadeGridOutAnimation = new DoubleAnimation(0, TimeSpan.FromSeconds(0.1)); Command.Visibility = Visibility.Hidden; Download.Visibility = Visibility.Hidden; HintLabel.Visibility = Visibility.Visible; HintLabel.Content = "Starting replay download"; } HintLabel.Content = "That player is not in a game"; HintLabel.Visibility = Visibility.Visible; } }
private async void Download_Click(object sender, RoutedEventArgs e) { if (User == true) { PublicSummoner Summoner = await Client.PVPNet.GetSummonerByName(Command.Text); if (String.IsNullOrWhiteSpace(Summoner.Name)) { MessageOverlay overlay = new MessageOverlay(); overlay.MessageTitle.Content = "No Summoner Found"; overlay.MessageTextBox.Text = "The summoner \"" + Command.Text + "\" does not exist."; Client.OverlayContainer.Content = overlay.Content; Client.OverlayContainer.Visibility = Visibility.Visible; return; } HintLabel.Content = "retrieving replay"; HintLabel.Visibility = Visibility.Visible; var fadeLabelInAnimationx = new DoubleAnimation(1, TimeSpan.FromSeconds(0.1)); HintLabel.BeginAnimation(Label.OpacityProperty, fadeLabelInAnimationx); PlatformGameLifecycleDTO n = await Client.PVPNet.RetrieveInProgressSpectatorGameInfo(Command.Text); if (n.GameName != null) { int port = n.PlayerCredentials.ServerPort; string IP; if (port == 0) { IP = n.PlayerCredentials.ObserverServerIp + ":8088"; } else { IP = n.PlayerCredentials.ObserverServerIp + ":" + port; } string Key = n.PlayerCredentials.ObserverEncryptionKey; int GameID = (Int32)n.PlayerCredentials.GameId; recorder = new ReplayRecorder(IP, GameID, Client.Region.InternalName, Key); recorder.OnReplayRecorded += recorder_OnReplayRecorded; recorder.OnGotChunk += recorder_OnGotChunk; var fadeGridOutAnimation = new DoubleAnimation(0, TimeSpan.FromSeconds(0.1)); Command.Visibility = Visibility.Hidden; Download.Visibility = Visibility.Hidden; HintLabel.Visibility = Visibility.Visible; HintLabel.Content = "Starting replay download"; return; } else { HintLabel.Content = "That player is not in a game"; HintLabel.Visibility = Visibility.Visible; return; } } }
private void WaterTextbox_PasswordChanged(object sender, RoutedEventArgs e) { if (WaterTextbox.Password.Length > 0) { var fadeLabelOutAnimation = new DoubleAnimation(0, TimeSpan.FromSeconds(0.1)); HintLabel.BeginAnimation(Label.OpacityProperty, fadeLabelOutAnimation); } else { var fadeLabelInAnimation = new DoubleAnimation(1, TimeSpan.FromSeconds(0.1)); HintLabel.BeginAnimation(Label.OpacityProperty, fadeLabelInAnimation); } }
private void Download_Click(object sender, RoutedEventArgs e) { HintLabel.Content = "retrieving replay"; HintLabel.Visibility = Visibility.Visible; var fadeLabelInAnimation = new DoubleAnimation(1, TimeSpan.FromSeconds(0.1)); HintLabel.BeginAnimation(Label.OpacityProperty, fadeLabelInAnimation); string SpectatorCommand = Command.Text; string[] RemoveExcessInfo = SpectatorCommand.Split(new string[1] { "spectator " }, StringSplitOptions.None); if (RemoveExcessInfo.Length != 2) { HintLabel.Content = "invalid command"; HintLabel.Visibility = Visibility.Visible; return; } string[] Info = RemoveExcessInfo[1].Replace("\"", "").Split(' '); if (Info.Length != 4) { HintLabel.Content = "invalid command"; HintLabel.Visibility = Visibility.Visible; return; } Command.Text = ""; int GameId = Convert.ToInt32(Info[2]); recorder = new ReplayRecorder(Info[0], GameId, Info[3], Info[1]); recorder.OnReplayRecorded += recorder_OnReplayRecorded; recorder.OnGotChunk += recorder_OnGotChunk; var fadeGridOutAnimation = new DoubleAnimation(0, TimeSpan.FromSeconds(0.1)); Command.Visibility = Visibility.Hidden; Download.Visibility = Visibility.Hidden; }