Beispiel #1
0
 public void Hide()
 {
     UiThread.Dispatch(() =>
     {
         _scoreLabel.Visibility = Visibility.Hidden;
     });
 }
Beispiel #2
0
 public void Hide()
 {
     UiThread.Dispatch(() =>
     {
         _photoRectangle.Visibility = Visibility.Hidden;
     });
 }
Beispiel #3
0
 public void Refresh()
 {
     UiThread.Dispatch(() =>
     {
         System.Windows.Controls.Canvas.SetLeft(_photoRectangle, _photo.Center.X - _width / 2);
         System.Windows.Controls.Canvas.SetTop(_photoRectangle, _photo.Center.Y - _height / 2);
     });
 }
Beispiel #4
0
 public void Show()
 {
     UiThread.Dispatch(() =>
     {
         _rectangle.Visibility        = Visibility.Visible;
         _nationalityLabel.Visibility = Visibility.Visible;
     });
 }
Beispiel #5
0
 public void Show(int currentScore)
 {
     UiThread.Dispatch(() =>
     {
         _scoreLabel.Content    = $"Total score is {currentScore}";
         _scoreLabel.Visibility = Visibility.Visible;
     });
 }
Beispiel #6
0
        private void AddControls()
        {
            UiThread.Dispatch(() =>
            {
                AddRectangle();

                AddNationalityLabel();
            });
        }
Beispiel #7
0
        public void Hide()
        {
            UiThread.Dispatch(() =>
            {
                _scoreLabel.Content = string.Empty;

                _stackPanel.Visibility = Visibility.Hidden;
            });
        }
Beispiel #8
0
        public void Show(int totalScore)
        {
            UiThread.Dispatch(() =>
            {
                _scoreLabel.Content = $"Your total score is {totalScore}";

                _stackPanel.Visibility = Visibility.Visible;
            });
        }
Beispiel #9
0
        private void CreateControls()
        {
            UiThread.Dispatch(() =>
            {
                CreateStackPanel();

                CreateScoreLabel();

                CreatePlayAgainButton();
            });
        }
Beispiel #10
0
        public void Show(Photo photo)
        {
            _photo = photo;

            UiThread.Dispatch(() =>
            {
                RemovePreviousPhotoRectangleIfExists();

                CreatePhotoRectangle();
            });

            Refresh();
        }
Beispiel #11
0
        public void StartFadingOut(double durationInMs)
        {
            UiThread.Dispatch(() =>
            {
                var animation = new DoubleAnimation
                {
                    From         = 1.0,
                    To           = 0.0,
                    FillBehavior = FillBehavior.Stop,
                    BeginTime    = TimeSpan.FromSeconds(0),
                    Duration     = new Duration(TimeSpan.FromMilliseconds(durationInMs))
                };

                var storyboard = new Storyboard();
                storyboard.Children.Add(animation);

                Storyboard.SetTarget(animation, _photoRectangle);
                Storyboard.SetTargetProperty(animation, new PropertyPath(OpacityProperty));

                storyboard.Completed += delegate { _photoRectangle.Visibility = Visibility.Hidden; };

                storyboard.Begin();
            });
        }
Beispiel #12
0
 private void CreateControls()
 {
     UiThread.Dispatch(CreateScoreLabel);
 }