Пример #1
0
        private void OnSizeChanged(object sender, SizeChangedEventArgs sizeChangedEventArgs)
        {
            if (sizeChangedEventArgs.NewSize.Width < sizeChangedEventArgs.NewSize.Height)
            {
                //TopRow.Height = new GridLength(100, GridUnitType.Pixel);

                BigBoard.Visibility   = Visibility.Collapsed;
                SmallBoard.Visibility = Visibility.Visible;
                LeftColumn.Width      = new GridLength(1, GridUnitType.Star);
                RightColumn.Width     = new GridLength(0, GridUnitType.Pixel);

                //backButton.Style = Application.Current.Resources["SnappedBackButtonStyle"] as Style;
                //pageTitle.Style = Application.Current.Resources["SnappedPageHeaderTextStyle"] as Style;

                Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
                {
                    var size = Math.Min(BottomRow.ActualHeight, LeftColumn.ActualWidth);
                    //SmallBoardScrollViewer.Width = SmallBoardScrollViewer.Height = size;
                    SmallBoard.Width = SmallBoard.Height = size;

                    SmallBoard.FixPieces();
                });
            }
            else
            {
                //TopRow.Height = new GridLength(140, GridUnitType.Pixel);

                BigBoard.Visibility   = Visibility.Visible;
                SmallBoard.Visibility = Visibility.Collapsed;
                LeftColumn.Width      = new GridLength(1, GridUnitType.Auto);
                RightColumn.Width     = new GridLength(1, GridUnitType.Star);

                //backButton.Style = Application.Current.Resources["BackButtonStyle"] as Style;
                //pageTitle.Style = Application.Current.Resources["PageHeaderTextStyle"] as Style;

                Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
                {
                    var size = Math.Min(ActualHeight, RightColumn.ActualWidth);
                    //BigBoardScrollViewer.Width = BigBoardScrollViewer.Height = size;
                    BigBoard.Width = BigBoard.Height = size;

                    BigBoard.FixPieces();
                });
            }
        }
Пример #2
0
        private void AdjustToVm(string propertyName)
        {
            if (_viewModel == null)
            {
                return;
            }

            switch (propertyName)
            {
            case nameof(GamePageViewModel.MessageText):
                if (!String.IsNullOrEmpty(_viewModel.MessageText))
                {
                    BigBoard.DisplayMessageAnimation();
                    SmallBoard.DisplayMessageAnimation();
                }
                else
                {
                    BigBoard.HideMessageAnimation();
                    SmallBoard.HideMessageAnimation();
                }
                break;

            case nameof(GamePageViewModel.WhoseTurn):
                if (_viewModel.WhoseTurn == 0)
                {
                    BouncePlayer1Storyboard.Begin();
                    BouncePlayer2Storyboard.Stop();
                }
                else
                {
                    BouncePlayer1Storyboard.Stop();
                    BouncePlayer2Storyboard.Begin();
                }
                break;
            }
        }
Пример #3
0
    public static void Main(string[] args)
    {
        SmallBoard b1 = new SmallBoard();

        b1.Print();
    }