Exemple #1
0
 private void button_Save_Click(object sender, EventArgs e)
 {
     foreach (Control con in panel1.Controls)
     {
         if (con is PointDetailedSetControl)
         {
             PointDetailedSetControl queryP = (PointDetailedSetControl)con;
             queryP.Save();
         }
     }
 }
Exemple #2
0
        public void InitForm()
        {
            if (_PointA == null)
            {
                return;
            }
            StationModule _stationM = StationManage.FindStation(_PointA.strStationName);

            if (_stationM != null)
            {
                for (int i = 0; i < _stationM.arrAxis.Count; i++)
                {
                    PointDetailedSetControl queryP = new PointDetailedSetControl(_stationM.arrAxis[i]);
                    queryP.PointM           = _PointA.arrPoint[i];
                    queryP.lblAxisName.Text = _stationM.arrAxis[i].AxisName;


                    queryP.Location = new Point(3, 3 + i * queryP.Height + i * 5);
                    panel1.Controls.Add(queryP);
                }
            }
        }
Exemple #3
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();
            }
        }