/// <summary>
 /// Handles the Click event of the back control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Windows.RoutedEventArgs" /> instance containing the event data.</param>
 private void BackButton_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     if (OnBackButtonClicked != null)
     {
         OnBackButtonClicked.Invoke(this, e);
     }
 }
        public StreetGalleryControl()
        {
            InitializeComponent();
            StreetImageListViewModel = new StreetImageListViewModel();
            // 左右button的点击事件
            LeftButton.Click  += (sender, args) => { StreetImageListViewModel.SelectedIndex--; };
            RightButton.Click += (sender, args) => { StreetImageListViewModel.SelectedIndex++; };

            GalleryBackButtonControl.OnBackButtonClicked += () =>
            {
                Shown = false;
                OnBackButtonClicked?.Invoke();
            };

            Carousel.SelectionChanged += (sender, arg) =>
            {
                BackgroundDownImage.Source = StreetImageListViewModel.ImageViewModels[Carousel.SelectedIndex]
                                             .ThumbnailImage;
                // 准备动画并播放
                var storyboard = new Storyboard();
                // 背景切换模糊
                storyboard.Children.Add(GetOpacityAnimation(BackgroundUpImage, true));
                storyboard.Begin();
                storyboard.Completed += (_sender, _e) =>
                {
                    // 设置背景图上层图片
                    BackgroundUpImage.Source = StreetImageListViewModel.ImageViewModels[Carousel.SelectedIndex]
                                               .ThumbnailImage;
                };
            };
        }
示例#3
0
        public void Update(GameTime gameTime)
        {
            touchCollection = TouchPanel.GetState();
            while (TouchPanel.IsGestureAvailable)
            {
                gesture = TouchPanel.ReadGesture();
                switch (gesture.GestureType)
                {
                case GestureType.Flick:
                {
                    if (gesture.Delta.X > 0 && gesture.Delta.Y > 0)        //topright
                    {
                        if (gesture.Delta.X < gesture.Delta.Y)
                        {
                            OnFlickDown?.Invoke(gesture, null);
                        }
                        else
                        {
                            OnFlickRight?.Invoke(gesture, null);
                        }
                    }
                    else if (gesture.Delta.X > 0 && gesture.Delta.Y < 0)        //bottomright
                    {
                        if (gesture.Delta.X < -gesture.Delta.Y)
                        {
                            OnFlickUp?.Invoke(gesture, null);
                        }
                        else
                        {
                            OnFlickRight?.Invoke(gesture, null);
                        }
                    }
                    else if (gesture.Delta.X < 0 && gesture.Delta.Y < 0)        //bottomleft
                    {
                        if (-gesture.Delta.X < -gesture.Delta.Y)
                        {
                            OnFlickUp?.Invoke(gesture, null);
                        }
                        else
                        {
                            OnFlickLeft?.Invoke(gesture, null);
                        }
                    }
                    else if (gesture.Delta.X < 0 && gesture.Delta.Y > 0)        //topleft
                    {
                        if (-gesture.Delta.X < gesture.Delta.Y)
                        {
                            OnFlickDown?.Invoke(gesture, null);
                        }
                        else
                        {
                            OnFlickLeft?.Invoke(gesture, null);
                        }
                    }
                    break;
                }

                case GestureType.Tap:
                {
                    if (ScaledResolution != Vector2.Zero)
                    {
                        OnTap?.Invoke(new Vector2(gesture.Position.X / TouchPanel.DisplayWidth * ScaledResolution.X, gesture.Position.Y / TouchPanel.DisplayHeight * ScaledResolution.Y), null);
                    }

                    break;
                }
                }
            }
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                OnBackButtonClicked?.Invoke(this, null);
            }
        }
示例#4
0
 private void BackButton_Click(object sender, EventArgs e)
 {
     InitializePlayers();
     OnBackButtonClicked?.Invoke(this, EventArgs.Empty);
 }
示例#5
0
        public BackButtonControl()
        {
            InitializeComponent();

            BackButton.Click += (sender, args) => { OnBackButtonClicked?.Invoke(); };
        }
示例#6
0
 private void BackButton_Click(object sender, EventArgs e)
 {
     OnBackButtonClicked?.Invoke(this, EventArgs.Empty);
 }