Ejemplo n.º 1
0
        private void button_AddInputIo_Click(object sender, EventArgs e)
        {
            bool blnScroll         = false;
            int  intVerticalScroll = 0;

            if (intInputControlCount >= StationManage.intStationIoInputCount)
            {
                MessageBoxLog.Show("工位可配输入IO已达最大");
                return;
            }
            if (intInputControlCount < 1)
            {
                IOInputSetLabelControl ioinlab = new IOInputSetLabelControl();
                panel_InputIo.Controls.Add(ioinlab);
                ioinlab.Location = new Point(3, 1);
            }

            if (_StationM.arrInputIo.Count == intInputControlCount)
            {
                _StationM.arrInputIo.Add(new IOParameter());
            }
            else
            {
                if (intInputControlCount >= 0)
                {
                    _StationM.arrInputIo[intInputControlCount] = new IOParameter();
                }
            }

            if (panel_InputIo.VerticalScroll.Value > 0)
            {
                intVerticalScroll = panel_InputIo.VerticalScroll.Value;
                panel_InputIo.VerticalScroll.Value = panel_InputIo.VerticalScroll.Minimum;
                blnScroll = true;
            }
            IOSetPanelControl setC = new IOSetPanelControl();

            panel_InputIo.Controls.Add((Control)setC);
            setC.Location = new Point(3, 27 + intInputControlCount * setC.Height + intInputControlCount * 5);
            setC.IO       = _StationM.arrInputIo[intInputControlCount];
            if (blnScroll)
            {
                panel_InputIo.AutoScrollPosition = new Point(panel_InputIo.HorizontalScroll.Value, intVerticalScroll);
            }

            intInputControlCount++;
        }
Ejemplo n.º 2
0
        public void IOSet_Load_Station(string stationName)
        {
            if (StationManage._Config == null || StationManage._Config.arrWorkStation == null)
            {
                return;
            }
            int           i          = 0;
            int           j          = 0;
            List <object> listObject = new List <object>();

            panel_out.Controls.Clear();
            panel_IO.Controls.Clear();
            tag_list.Clear();
            foreach (StationModule sm in StationManage._Config.arrWorkStation)
            {
                if (sm.strStationName == stationName)
                {
                    foreach (IOParameter ioP in sm.arrInputIo)
                    {
                        if (IoisInList(listObject, ioP))
                        {
                            continue;
                        }
                        listObject.Add(ioP);
                        IOSetPanelControl ioinput = new IOSetPanelControl(ioP);
                        ioinput.Location = new Point(i % 2 * 340, i / 2 * 30);
                        panel_IO.Controls.Add(ioinput);
                        tag_list.Add(ioinput);
                        i++;
                    }
                    foreach (IOParameter ioP in sm.arrOutputIo)
                    {
                        if (IoisInList(listObject, ioP))
                        {
                            continue;
                        }
                        listObject.Add(ioP);
                        IOSetPanelControl ioinput = new IOSetPanelControl(ioP);
                        ioinput.Location = new Point(0, j * 30);
                        panel_out.Controls.Add(ioinput);
                        tag_list.Add(ioinput);
                        j++;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void IODebugSetPanelControl_Load(object sender, EventArgs e)
        {
            if (StationManage._Config == null || StationManage._Config.arrWorkStation == null)
            {
                return;
            }
            int           i          = 0;
            int           j          = 0;
            List <object> listObject = new List <object>();

            foreach (StationModule sm in StationManage._Config.arrWorkStation)
            {
                foreach (IOParameter ioP in sm.arrInputIo)
                {
                    if (IoisInList(listObject, ioP))
                    {
                        continue;
                    }
                    listObject.Add(ioP);
                    IOSetPanelControl ioinput = new IOSetPanelControl(ioP);
                    ioinput.Location = new Point(i % 2 * 340, i / 2 * 30);
                    panel_IO.Controls.Add(ioinput);
                    tag_list.Add(ioinput);
                    i++;
                }
                foreach (IOParameter ioP in sm.arrOutputIo)
                {
                    if (IoisInList(listObject, ioP))
                    {
                        continue;
                    }
                    listObject.Add(ioP);
                    IOSetPanelControl ioinput = new IOSetPanelControl(ioP);
                    ioinput.Location = new Point(0, j * 30);
                    panel_out.Controls.Add(ioinput);
                    tag_list.Add(ioinput);
                    j++;
                }
            }
        }
Ejemplo n.º 4
0
        public void InitForm()
        {
            try
            {
                int i = 0;
                if (_StationM != null && !string.IsNullOrEmpty(_StationM.strStationName))
                {
                    for (i = 0; i < intAxisControlCount; i++)
                    {
                        if (i == 0)
                        {
                            AxisSetLabelControl axisL = new AxisSetLabelControl();
                            panel_Axis.Controls.Add(axisL);
                            axisL.Location = new Point(42, 5);
                        }
                        AxisSetConfigControl setC = new AxisSetConfigControl();
                        panel_Axis.Controls.Add((Control)setC);
                        setC.Location = new Point(3, 32 + i * setC.Height + i * 5);
                        setC.AxisSet  = _StationM.arrAxis[i];

                        cboAxisName.Items.Add(_StationM.arrAxis[i].AxisName);
                    }
                    if (cboAxisName.Items.Count > 0)
                    {
                        cboAxisName.SelectedIndex = 0;
                    }
                    for (i = 0; i < intInputControlCount; i++)
                    {
                        if (i == 0)
                        {
                            IOInputSetLabelControl ioinlab = new IOInputSetLabelControl();
                            panel_InputIo.Controls.Add(ioinlab);
                            ioinlab.Location = new Point(3, 1);
                        }
                        IOSetPanelControl inputIo = new IOSetPanelControl();
                        panel_InputIo.Controls.Add((Control)inputIo);
                        inputIo.Location = new Point(3, 27 + i * inputIo.Height + i * 5);
                        inputIo.IO       = _StationM.arrInputIo[i];
                    }
                    for (i = 0; i < intOutputControlCount; i++)
                    {
                        if (i == 0)
                        {
                            IOOutputSetLabelControl iooutlb = new IOOutputSetLabelControl();
                            panel_OutputIo.Controls.Add(iooutlb);
                            iooutlb.Location = new Point(3, 1);
                        }
                        IOSetPanelControl outputIo = new IOSetPanelControl();
                        panel_OutputIo.Controls.Add((Control)outputIo);
                        outputIo.Location = new Point(3, 27 + i * outputIo.Height + i * 5);
                        outputIo.IO       = _StationM.arrOutputIo[i];
                    }

                    int m = 0;
                    for (i = 0; i < intPointControlCount; i++)
                    {
                        if (i == 0)
                        {
                            PointLabel = new PointDetailedSetUILabelControl(_StationM, intAxisControlCount);
                            panel_Point.Controls.Add((Control)PointLabel);
                            PointLabel.Location = new Point(85, 18);
                        }


                        if (_StationM.arrPoint[i].tag_BeginPointAggregateList != null)
                        {
                            foreach (PointAggregate pa in _StationM.arrPoint[i].tag_BeginPointAggregateList)
                            {
                                if (IsAdd(pa) == true)
                                {
                                    PointSetControl setP = new PointSetControl();
                                    panel_Point.Controls.Add((Control)setP);
                                    setP.Location       = new Point(17, 53 + (m) * setP.Height + m * 5);
                                    setP.intAxisCount   = intAxisControlCount;
                                    setP.PointAggregate = pa;
                                    tag_PointAggregateList.Add(pa);
                                    m++;
                                }
                            }
                        }
                        if (IsAdd(_StationM.arrPoint[i]) == true)
                        {
                            PointSetControl setP1 = new PointSetControl();
                            panel_Point.Controls.Add((Control)setP1);
                            setP1.Location       = new Point(17, 53 + (m) * setP1.Height + m * 5);
                            setP1.intAxisCount   = intAxisControlCount;
                            setP1.PointAggregate = _StationM.arrPoint[i];
                            tag_PointAggregateList.Add(_StationM.arrPoint[i]);
                            m++;
                        }
                        if (_StationM.arrPoint[i].tag_EndPointAggregateList != null)
                        {
                            foreach (PointAggregate pa in _StationM.arrPoint[i].tag_EndPointAggregateList)
                            {
                                if (IsAdd(pa) == true)
                                {
                                    PointSetControl setP = new PointSetControl();
                                    panel_Point.Controls.Add((Control)setP);
                                    setP.Location       = new Point(17, 53 + (m) * setP.Height + m * 5);
                                    setP.intAxisCount   = intAxisControlCount;
                                    setP.PointAggregate = pa;
                                    tag_PointAggregateList.Add(pa);
                                    m++;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception mess)
            {
                LogOutControl.OutLog(mess.Message, 0);
            }
        }
Ejemplo n.º 5
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            int i = 0;

            _StationM.intUseAxisCount     = intAxisControlCount;
            _StationM.intUseInputIoCount  = intInputControlCount;
            _StationM.intUseOutputIoCount = intOutputControlCount;
            _StationM.intUsePointCount    = intPointControlCount;
            if (intAxisControlCount > 0)
            {
                foreach (Control con in panel_Axis.Controls)
                {
                    if (con is AxisSetConfigControl)
                    {
                        AxisSetConfigControl setA = (AxisSetConfigControl)con;
                        setA.Save();
                    }
                }
                for (i = intAxisControlCount; i < _StationM.arrAxis.Count; i++)
                {
                    _StationM.arrAxis.RemoveAt(i);
                    i = intAxisControlCount;
                }
            }
            else
            {
                _StationM.arrAxis.Clear();
            }
            if (intInputControlCount > 0)
            {
                foreach (Control con in panel_InputIo.Controls)
                {
                    if (con is IOSetPanelControl)
                    {
                        IOSetPanelControl setInput = (IOSetPanelControl)con;
                        setInput.Save();
                    }
                }
                for (i = intInputControlCount; i < _StationM.arrInputIo.Count; i++)
                {
                    _StationM.arrInputIo.RemoveAt(i);
                    i = intInputControlCount;
                }
            }
            else
            {
                _StationM.arrInputIo.Clear();
            }
            if (intOutputControlCount > 0)
            {
                foreach (Control con in panel_OutputIo.Controls)
                {
                    if (con is IOSetPanelControl)
                    {
                        IOSetPanelControl setOutput = (IOSetPanelControl)con;
                        setOutput.Save();
                    }
                }
                for (i = intOutputControlCount; i < _StationM.arrOutputIo.Count; i++)
                {
                    _StationM.arrOutputIo.RemoveAt(i);
                    i = intOutputControlCount;
                }
            }
            else
            {
                _StationM.arrOutputIo.Clear();
            }
            if (intPointControlCount > 0)
            {
                foreach (Control con in panel_Point.Controls)
                {
                    if (con is PointDetailedSetControl)
                    {
                        PointDetailedSetControl setP = (PointDetailedSetControl)con;
                        setP.Save();
                    }
                }
                for (i = intPointControlCount; i < _StationM.arrPoint.Count; i++)
                {
                    _StationM.arrPoint.RemoveAt(i);
                    i = intPointControlCount;
                }
            }
            else
            {
                _StationM.arrPoint.Clear();
            }
            if (!_Worker.Config.Save())
            {
                MessageBoxLog.Show("保存参数异常");
            }
            else
            {
                MessageBoxLog.Show("保存成功");
                this.Close();
                //RefreshStation();
            }
        }