コード例 #1
0
        private void button_Axis_Refresh_Click(object sender, EventArgs e)
        {
            int i = 0;

            panel_Axis.Controls.Clear();
            cboAxisName.Items.Clear();
            if (_StationM != null && !string.IsNullOrEmpty(_StationM.strStationName))
            {
                for (i = 0; i < _StationM.intUseAxisCount; 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);
                }
                intAxisControlCount = _StationM.intUseAxisCount;
            }
        }
コード例 #2
0
 private void button_Save_Click(object sender, EventArgs e)
 {
     foreach (Control con in Panel_SetAxis.Controls)
     {
         if (con is AxisSetConfigControl)
         {
             AxisSetConfigControl setA = (AxisSetConfigControl)con;
             setA.Save();
         }
     }
 }
コード例 #3
0
        private void button_AddAxis_Click(object sender, EventArgs e)
        {
            AxisConfig axis = new AxisConfig();

            axis.AxisIndex = _Worker._Config.axisArray.Count;;
            _Worker._Config.axisArray.Add(axis);
            AxisSetConfigControl setC = new AxisSetConfigControl();

            Panel_SetAxis.Controls.Add((Control)setC);
            setC.Location = new Point(3, 32 + axis.AxisIndex * setC.Height + axis.AxisIndex * 5);
            setC.AxisSet  = axis;
        }
コード例 #4
0
 private void SetAxisUI_Load(object sender, EventArgs e)
 {
     if (_Worker._Config.axisArray != null)
     {
         int i = 0;
         if (i == 0)
         {
             AxisSetLabelControl axisL = new AxisSetLabelControl();
             Panel_SetAxis.Controls.Add(axisL);
             axisL.Location = new Point(42, 5);
         }
         while (i < _Worker._Config.axisArray.Count)
         {
             AxisSetConfigControl setC = new AxisSetConfigControl();
             Panel_SetAxis.Controls.Add((Control)setC);
             setC.Location = new Point(3, 32 + i * setC.Height + i * 5);
             setC.AxisSet  = _Worker._Config.axisArray[i];
             i++;
         }
     }
 }
コード例 #5
0
        private void button_RemoveAxis_Click(object sender, EventArgs e)
        {
            Control[] finChild = new Control[CardManager.iMaxAxisCount];
            int       i        = 0;

            foreach (Control con in Panel_SetAxis.Controls)
            {
                if (con is AxisSetConfigControl)
                {
                    finChild[i] = con;
                    i++;
                }
            }
            if (i > 0)
            {
                AxisSetConfigControl sac = (AxisSetConfigControl)finChild[i - 1];
                Panel_SetAxis.Controls.Remove(sac);
                _Worker._Config.axisArray.Remove(sac.AxisSet);
            }
            else
            {
                MessageBoxLog.Show("轴已清空!");
            }
        }
コード例 #6
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);
            }
        }
コード例 #7
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();
            }
        }