Ejemplo n.º 1
0
        public void refreshControl()
        {
            try
            {
                // 放入dicSaddles中
                theAreaInfoInBay.getPortionAreaData();
                //theAreaInfoInBay1.getPortionAreaData1();
                theAreaInfoInBay.getTagNameList();
                theAreaInfoInBay.getTagValues();



                // 遍历所有从表中读取的区域元件
                foreach (AreaBase theAreaInfo in theAreaInfoInBay.DicSaddles.Values.ToArray())
                {
                    conArea theSaddleVisual = new conArea();
                    if (dicAreaVisual.ContainsKey(theAreaInfo.AreaNo))
                    {
                        theSaddleVisual = dicAreaVisual[theAreaInfo.AreaNo];
                    }
                    else
                    {
                        //theSaddleVisual = new conArea();
                        bayPanel.Invoke(new Action(() => { bayPanel.Controls.Add(theSaddleVisual); }));
                    }

                    // 新建委托
                    conArea.areaRefreshInvoke theInvoke = new conArea.areaRefreshInvoke(theSaddleVisual.refreshControl);
                    if (theSaddleVisual.IsHandleCreated)
                    {
                        // 调用委托进行refresh
                        theSaddleVisual.Invoke(theInvoke, new Object[] { theAreaInfo, baySpaceX, baySpaceY, panelWidth, panelHeight, xAxisRight, yAxisDown, bayPanel, theSaddleVisual });
                    }
                    //theSaddleVisual.Saddle_Selected -= new conArea.EventHandler_Saddle_Selected(theSaddleVisual_Saddle_Selected);
                    //theSaddleVisual.Saddle_Selected += new conArea.EventHandler_Saddle_Selected(theSaddleVisual_Saddle_Selected);
                    dicAreaVisual[theAreaInfo.AreaNo] = theSaddleVisual;
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteProgramLog(bayNO);
                LogManager.WriteProgramLog(ex.Message);
                LogManager.WriteProgramLog(ex.StackTrace);
            }
        }
Ejemplo n.º 2
0
        public void refreshControl(AreaBase theSaddle, long baySpaceX, long baySpaceY, int panelWidth, int panelHeight, bool xAxisRight, bool yAxisDown, Panel panel, conArea _conArea)
        {
            try
            {
                areaBase = theSaddle;

                //计算X方向上的比例关系
                double xScale = Convert.ToDouble(panelWidth) / Convert.ToDouble(baySpaceX);

                double location_X = 0;
                if (xAxisRight == true)
                {
                    location_X = Convert.ToDouble(theSaddle.X_Start) * xScale;
                }
                else
                {
                    location_X = Convert.ToDouble(baySpaceX - (theSaddle.X_End)) * xScale;
                }
                //计算y方向上的比例关系
                double yScale = Convert.ToDouble(panelHeight) / Convert.ToDouble(baySpaceY);

                double location_Y = 0;
                if (yAxisDown == true)
                {
                    location_Y = Convert.ToDouble(theSaddle.Y_Start) * yScale;
                }
                else
                {
                    location_Y = Convert.ToDouble(baySpaceY - (theSaddle.Y_End)) * yScale;
                }
                if (location_Y < 0)
                {
                    location_Y = 0;
                }

                //定位库区的坐标
                this.Location = new Point(Convert.ToInt32(location_X), Convert.ToInt32(location_Y));

                //设置鞍座控件的宽度
                this.Width = Convert.ToInt32((theSaddle.X_End - theSaddle.X_Start) * xScale);
                //设置鞍座控件的高度
                this.Height = Convert.ToInt32((theSaddle.Y_End - theSaddle.Y_Start) * yScale);


                //当控件的宽小于1时 不显示控件
                if (this.Width < 1)
                {
                    this.Visible = false;
                }

                if (theSaddle.AreaType == 0)
                {
                    if (!isCreateLbl)
                    {
                        lbl.Name      = theSaddle.AreaNo;
                        lbl.BackColor = Color.MediumAquamarine;
                        lbl.Font      = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                        lbl.Width     = 95;
                        lbl.Height    = 100;
                        lbl.ForeColor = Color.Black;
                        lbl.Click    += conArea_Click;
                        _conArea.Controls.Add(lbl);

                        // List<int> list = rowInfo.getAreaNoRow(areaBase.AreaNo) as List<int>;
                        // lblRuler = rowInfo.getAreaRowsInfo(list);

                        isCreateLbl = true;
                    }

                    if (panel.Width < 1400)
                    {
                        lbl.Width  = 60;
                        lbl.Height = 20;
                        //lbl.Text = lblRuler;
                    }
                    else
                    {
                        lbl.Width  = 95;
                        lbl.Height = 100;
                        lbl.Text   = "鞍座总数:" + theSaddle.AreaSaddleNum + "\n"
                                     + "白库位:   " + theSaddle.AreaSaddleNoCoilNum + "\n"
                                     + "黑库位:   " + theSaddle.AreaSaddleCoilNum + "\n"
                                     + "红库位:   " + (theSaddle.AreaSaddleNum - theSaddle.AreaSaddleNoCoilNum - theSaddle.AreaSaddleCoilNum);
                    }
                    //设置显示的颜色(包括安全门)
                    //if (theSaddle.AreaDoorSefeValue == 0 && theSaddle.AreaDoorReserveValue == 0)
                    //    this.BackColor = System.Drawing.Color.Red;
                    //else if (theSaddle.AreaDoorSefeValue == 0 && theSaddle.AreaDoorReserveValue == 1)
                    //    this.BackColor = System.Drawing.Color.Blue;
                    //else if (theSaddle.AreaDoorSefeValue == 1 && theSaddle.AreaDoorReserveValue == 1)
                    //    this.BackColor = System.Drawing.Color.Yellow;
                    //else
                    this.BackColor = System.Drawing.Color.DarkSeaGreen;



                    lbl.Location  = new Point(this.Width / 2 - 30, this.Height / 2 - 20);
                    lbl.BackColor = this.BackColor;
                }
                else if (theSaddle.AreaType == 1) //通道
                {
                    this.BackColor = Color.LightSlateGray;
                }
                else if (theSaddle.AreaType == 2)  //运输链
                {
                    this.BackColor = Color.SandyBrown;
                }
                else if (theSaddle.AreaType == 4)  //机组出口
                {
                    this.BackColor = Color.MediumPurple;
                }
                else if (theSaddle.AreaType == 5)  //机组入口
                {
                    this.BackColor = Color.MediumSlateBlue;
                }
                else
                {
                    this.BackColor = Color.Coral;
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteProgramLog(ex.Message);
                LogManager.WriteProgramLog(ex.StackTrace);
            }
        }