예제 #1
0
        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);
            }
        }
예제 #2
0
 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);
 }
예제 #3
0
        private double GetRightPanelWidth(double deskLogicalWidth)
        {
            double rpWidth   = (double)WaParams.GetRightPanelWidth(Desk.Seller);
            double fullWidth = deskLogicalWidth + 12.0 + rpWidth;
            double val       = SystemParameters.WorkArea.Width - deskLogicalWidth + 12.0;

            if (fullWidth > SystemParameters.WorkArea.Width)
            {
                rpWidth = Math.Max(val, 365.0);
                WaParams.SetRightPanelWidth(Desk.Seller, (int)rpWidth);
            }
            else if (rpWidth < 400.0)
            {
                rpWidth = Math.Min(val, 400.0);
                WaParams.SetRightPanelWidth(Desk.Seller, (int)rpWidth);
            }
            return(rpWidth);
        }
예제 #4
0
        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);
        }