Exemple #1
0
        private void ExpandNewDeck()
        {
            const int widthWithoutHistoryPanel = 240;

            if (GridNewDeck.Visibility != Visible)
            {
                GridNewDeck.Visibility          = Visible;
                MenuNewDeck.Visibility          = Visible;
                ButtonVersionHistory.Visibility = _newDeck?.HasVersions ?? false ? Visible : Collapsed;
                GridNewDeck.Width = widthWithoutHistoryPanel;
                GridNewDeck.UpdateLayout();
                Width    += GridNewDeck.ActualWidth;
                MinWidth += GridNewDeck.ActualWidth;
            }
            DeckPickerListCover.Visibility  = Visible;
            PanelVersionComboBox.Visibility = Collapsed;
            BtnStartHearthstone.Visibility  = Collapsed;
            PanelCardCount.Visibility       = Visible;

            //move window left if opening the edit panel causes it to be outside of a screen
            foreach (var screen in Screen.AllScreens)
            {
                var windowLeft  = (int)Left;
                var windowRight = (int)(Left + Width);
                var screenLeft  = screen.WorkingArea.X;
                var screenRight = screen.WorkingArea.Right;

                //if the window is completely outside of this screen, just skip this screen
                if (windowRight < screenLeft || windowLeft > screenRight)
                {
                    continue;
                }

                //if the original window was partially on this screen but mostly on the screen to the right, just skip this screen
                if (windowLeft + (Width - GridNewDeck.ActualWidth) / 2 > screenRight && windowLeft > screenLeft)
                {
                    continue;
                }

                //if the new window is partially on this screen and partially on the screen to the right
                if (windowRight > screenRight && windowLeft < screenRight)
                {
                    //move window left by the change in width
                    Left -= (int)GridNewDeck.ActualWidth;

                    //if we would leave a distance to the edge of the screen greater than 50px
                    //just fully align the window to the right of the screen instead
                    if (screenRight - (Left + Width) > 50)
                    {
                        Left = screenRight - Width;
                    }

                    MovedLeft = windowLeft - Left;
                    break;
                }
            }
            UpdateExpansionIcons();
        }
 private void ExpandNewDeck()
 {
     if (GridNewDeck.Visibility != Visibility.Visible)
     {
         GridNewDeck.Visibility = Visibility.Visible;
         MenuNewDeck.Visibility = Visibility.Visible;
         GridNewDeck.UpdateLayout();
         Width    += GridNewDeck.ActualWidth;
         MinWidth += GridNewDeck.ActualWidth;
     }
     DeckPickerListCover.Visibility = Visibility.Visible;
 }
Exemple #3
0
        private void ExpandNewDeck()
        {
            const int widthWithHistoryPanel    = 485;
            const int widthWithoutHistoryPanel = 240;

            if (GridNewDeck.Visibility != Visibility.Visible)
            {
                GridNewDeck.Visibility = Visibility.Visible;
                MenuNewDeck.Visibility = Visibility.Visible;
                if (_newDeck != null && _newDeck.HasVersions)
                {
                    PanelDeckHistory.Visibility = Visibility.Visible;
                    GridNewDeck.Width           = widthWithHistoryPanel;
                }
                else
                {
                    GridNewDeck.Width = widthWithoutHistoryPanel;
                }
                GridNewDeck.UpdateLayout();
                Width    += GridNewDeck.ActualWidth;
                MinWidth += GridNewDeck.ActualWidth;
            }
            DeckPickerListCover.Visibility = Visibility.Visible;
        }