private void SetDeskLocation() { int minLeft = 0; int minTop = 0; double deskLogicalWidth = GetDeskLogicalWidth(); double rpWidth = (double)WaParams.GetRightPanelWidth(Desk.Seller); double deskLogicalLeft = GetDeskLogicalLeft(); if (deskLogicalLeft < 6.0 || deskLogicalLeft + deskLogicalWidth + rpWidth + 6.0 > SystemParameters.WorkArea.Width) { minLeft = (int)(SystemParameters.WorkArea.Width - deskLogicalWidth - rpWidth - 12.0); if (minLeft < 6) { minLeft = 6; } } double deskLogicalHeight = GetDeskLogicalHeight(); double bpHeight = (double)WaParams.GetBottomPanelHeight(Desk.Seller); double deskLogicalTop = GetDeskLogicalTop(); if (deskLogicalTop < 6.0 || deskLogicalTop + deskLogicalHeight + bpHeight + 12.0 > SystemParameters.WorkArea.Height) { minTop = (int)(SystemParameters.WorkArea.Height - deskLogicalHeight - bpHeight - 12.0); if (minTop < 6) { minTop = 6; } } if (minLeft == 0 || minTop == 0) { minLeft = minLeft == 0 ? Desk.Rect.Left : minLeft; minTop = minTop == 0 ? Desk.Rect.Top : minTop; Desk.SetLocation(minLeft, minTop); } }
private void Desk_EvMaximize(object sender, ChatDeskEventArgs e) { Desk.ShowNormal(); DispatcherEx.xInvoke(() => { XYRatio toLogicalRatio = ToLogicalRatio; double maxW = SystemParameters.WorkArea.Width - (double)WaParams.GetRightPanelWidth(Desk.Seller) - (double)12f; int w = (int)(maxW / toLogicalRatio.XRatio); double maxH = SystemParameters.WorkArea.Height - (double)WaParams.GetBottomPanelHeight(Desk.Seller) - (double)12f; int h = (int)(maxH / toLogicalRatio.YRatio); Desk.SetRect(6, 6, w, h); }); Track(false, false); }
private double GetBottomPanelHeight(double deskLogicalHeight) { double bHeight = (double)WaParams.GetBottomPanelHeight(Desk.Seller); double fullHeight = deskLogicalHeight + 12.0 + bHeight; double val = SystemParameters.WorkArea.Height - deskLogicalHeight + 12.0; if (fullHeight > SystemParameters.WorkArea.Height) { bHeight = Math.Max(val, 100.0); WaParams.SetBottomPanelHeight(Desk.Seller, (int)bHeight); } else if (bHeight < 150.0) { bHeight = Math.Min(val, 150.0); WaParams.SetBottomPanelHeight(Desk.Seller, (int)bHeight); } return(bHeight); }