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(); } } }
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(); } }