Beispiel #1
0
 void recorder_OnReplayRecorded()
 {
     Dispatcher.BeginInvoke(DispatcherPriority.Input, new Action(() =>
     {
         HintLabel.Margin = new Thickness(0, 30, 365, 0);
         SearchTextBox.Watermark = "replay downloaded";
         var fadeGridInAnimation = new DoubleAnimation(1, TimeSpan.FromSeconds(0.1));
         InputGrid.BeginAnimation(Grid.OpacityProperty, fadeGridInAnimation);
         InputGrid.Visibility = Visibility.Visible;
         UpdateReplays();
     }));
 }
Beispiel #2
0
        private void GetReplayButton_Click(object sender, RoutedEventArgs e)
        {
            HintLabel.Margin = new Thickness(0, 30, 365, 0);
            HintLabel.Content = "retrieving replay";
            var fadeLabelInAnimation = new DoubleAnimation(1, TimeSpan.FromSeconds(0.1));
            HintLabel.BeginAnimation(Label.OpacityProperty, fadeLabelInAnimation);

            string SpectatorCommand = SearchTextBox.WaterTextbox.Text;
            string[] RemoveExcessInfo = SpectatorCommand.Split(new string[1] { "spectator " }, StringSplitOptions.None);

            if (RemoveExcessInfo.Length != 2)
            {
                HintLabel.Content = "invalid command";
                HintLabel.Margin = new Thickness(0, 60, 365, 0);
                return;
            }

            string[] Info = RemoveExcessInfo[1].Replace("\"", "").Split(' ');

            if (Info.Length != 4)
            {
                HintLabel.Content = "invalid command";
                HintLabel.Margin = new Thickness(0, 60, 150, 0);
                return;
            }

            SearchTextBox.WaterTextbox.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));
            InputGrid.BeginAnimation(Grid.OpacityProperty, fadeGridOutAnimation);
            InputGrid.Visibility = Visibility.Hidden;
        }