public void SetCardPopupPosition(CardPopupSide side, int mainWindowTop, int mainWindowLeft, int mainWindowWidth) { var popupWidth = (int)Width; int toLeft = mainWindowLeft - popupWidth; int toRight = mainWindowLeft + mainWindowWidth; int leftAdjusted = side switch { CardPopupSide.Left => toLeft, CardPopupSide.Right => toRight, _ => (mainWindowLeft < SystemParameters.WorkArea.Width / 2 ? toRight : toLeft) }; Top = mainWindowTop; Left = leftAdjusted; CardsInPopup.SetCardPopupPosition(side, mainWindowTop, leftAdjusted, popupWidth); } }
//internal void SetDataContext(string cardChosen, ICollection<CardWpf> cards) //{ // vm.SetCards(cardChosen, cards); //} public void SetCardPopupPosition(ForceCardPopupSideEnum side, int mainWindowTop, int mainWindowLeft, int mainWindowWidth) { var popupWidth = (int)Width; var toLeft = mainWindowLeft - popupWidth; var toRight = mainWindowLeft + mainWindowWidth; var leftAdjusted = mainWindowLeft < SystemParameters.WorkArea.Width / 2 ? toRight : toLeft; if (side == ForceCardPopupSideEnum.Left) { leftAdjusted = toLeft; } else if (side == ForceCardPopupSideEnum.Right) { leftAdjusted = toRight; } Top = mainWindowTop; Left = leftAdjusted; CardsInPopup.SetCardPopupPosition(side, mainWindowTop, leftAdjusted, popupWidth); }