/// <summary> /// 保存旋翼控件到结构体对象 /// </summary> /// <returns></returns> private sXY saveXYControlToObject() { sXY dataXY = new sXY(); if (!this.chkModelXY.Checked) { //_Data.NDISK = 0; //_Data.XYData = null; return dataXY; } //TreeNode selNode = this.treeViewXY.SelectedNode; //if (selNode != null || this.XYlistView.SelectedItems.Count != 0) //{ if (!checkXY()) { return dataXY; } dataXY.ALF_TPP = this.tbALF_TPP.Text; dataXY.CHORD = this.tbCHORD.Text; //switch (this.cmbDISKAK.SelectedIndex) //{ // case 0: // dataXY.DISKAK=this.cmbDISKAK.se //} dataXY.DISKAK = Common.cmbdiskToDiskak(this.cmbDISKAK.SelectedIndex); dataXY.DISKX = this.tbDISKX.Text; dataXY.DISKY = this.tbDISKY.Text; dataXY.DISKZ = this.tbDISKZ.Text; dataXY.FLAP_0 = this.tbFLAP_0.Text; dataXY.FLAP_C1 = this.tbFLAP_C1.Text; dataXY.FLAP_S1 = this.tbFLAP_S1.Text; dataXY.HDISK = this.tbHDISK.Text; dataXY.INVERSE = this.cmbINVERSE.SelectedIndex; dataXY.MU = this.tbMU.Text; dataXY.N_BLADE = this.tbN_BLADE.Text; dataXY.OMIGA = this.tbOMIGA.Text; dataXY.PITCH_0 = this.tbPITCH_0.Text; dataXY.PITCH_C = this.tbPITCH_C.Text; dataXY.PITCH_S = this.tbPITCH_S.Text; dataXY.RADIUS = this.tbRADIUS.Text; dataXY.RADIUSC = this.tbRADIUSC.Text; dataXY.TWSIT = this.tbTWSIT.Text; dataXY.BLADE = string.Empty; for (int i = 0; i < this.dgvYX.Rows.Count; i++) { for (int j = 0; j < this.dgvYX.Columns.Count; j++) { if (j == 0) { dataXY.BLADE = dataXY.BLADE + this.dgvYX.Rows[i].Cells[j].Value.ToString(); } else { dataXY.BLADE = dataXY.BLADE + "#" + this.dgvYX.Rows[i].Cells[j].Value.ToString(); } } if (i < this.dgvYX.Rows.Count - 1) { dataXY.BLADE = dataXY.BLADE + "|"; } } return dataXY; // selNode.Tag = dataXY; // this.XYlistView.SelectedItems[0].Tag = dataXY; //} }
/// <summary> /// 从指定的旋翼结点加载数据到翼型Grid中. /// </summary> /// <param name="selNode"></param> private void loadYXGridFormNodeTag(sXY dataXY) { if (!dataXY.Equals(null)) { this.btnEditXY.Enabled = true; this.btnDelXY.Enabled = true; //sXY dataXY = (sXY)selNode.Tag; this.tbALF_TPP.Text = dataXY.ALF_TPP; this.tbCHORD.Text = dataXY.CHORD; this.cmbDISKAK.SelectedIndex = Common.diskakToCmbdisk(dataXY.DISKAK); this.tbDISKX.Text = dataXY.DISKX; this.tbDISKY.Text = dataXY.DISKY; this.tbDISKZ.Text = dataXY.DISKZ; this.tbFLAP_0.Text = dataXY.FLAP_0; this.tbFLAP_C1.Text = dataXY.FLAP_C1; this.tbFLAP_S1.Text = dataXY.FLAP_S1; this.tbHDISK.Text = dataXY.HDISK; this.cmbINVERSE.SelectedIndex = dataXY.INVERSE; this.tbMU.Text = dataXY.MU; this.tbN_BLADE.Text = dataXY.N_BLADE; this.tbOMIGA.Text = dataXY.OMIGA; this.tbPITCH_0.Text = dataXY.PITCH_0; this.tbPITCH_C.Text = dataXY.PITCH_C; this.tbPITCH_S.Text = dataXY.PITCH_S; this.tbRADIUS.Text = dataXY.RADIUS; this.tbRADIUSC.Text = dataXY.RADIUSC; this.tbTWSIT.Text = dataXY.TWSIT; this.dgvYX.Rows.Clear(); if (dataXY.BLADE != "") { string[] yx = dataXY.BLADE.Split(new Char[] { '|' }); for (int i = 0; i < yx.Length; i++) { string[] yxDGV = yx[i].Split(new Char[] { '#' }); this.dgvYX.Rows.Add(); int iRow = this.dgvYX.Rows.Count - 1; this.dgvYX.Rows[iRow].Cells[0].Value = yxDGV[0]; this.dgvYX.Rows[iRow].Cells[1].Value = yxDGV[1]; this.dgvYX.Rows[iRow].Cells[2].Value = yxDGV[2]; } } } }
public void SetData(ref AFATreeNode selNode) { if (selNode == null) { return; } m_Node = selNode; _Data = (sGK)selNode.Tag; m_oldName = _Data.Name; this.tbName.Text = _Data.Name; if (_Data.MODEL == "1") { this.chkModelXY.Checked = false; this.chkModelJQD.Checked = false; } if (_Data.MODEL == "11") { this.chkModelXY.Checked = true; this.chkModelJQD.Checked = false; } if (_Data.MODEL == "101") { this.chkModelXY.Checked = false; this.chkModelJQD.Checked = true; } if (_Data.MODEL == "111") { this.chkModelXY.Checked = true; this.chkModelJQD.Checked = true; } if (_Data.BLCONT == "1") { this.chkBLCONT.Checked = true; } else { this.chkBLCONT.Checked = false; } this.tbMACH_INF.Text = _Data.MACH_INF; this.tbRE.Text = _Data.RE; this.tbFUX.Text = _Data.F*X; this.tbFUY.Text = _Data.FUY; this.tbFUZ.Text = _Data.FUZ; this.tbPITCH_V.Text = _Data.PITCH_V; this.tbYAW_V.Text = _Data.YAW_V; //this.tbFLOWRATE.Text = _Data.FLOWRATE; this.tbZMU.Text = _Data.ZMU; string strXYName = string.Empty; for (int i = 0; i < _Data.NDISK; i++) { strXYName = "旋翼" + i.ToString(); ListViewItem item=new ListViewItem(); item.Text=strXYName; //node = new TreeNode(strXYName); sXY dataXY = new sXY(); dataXY.ALF_TPP = _Data.XYData[i].ALF_TPP; dataXY.CHORD = _Data.XYData[i].CHORD; dataXY.DISKAK = _Data.XYData[i].DISKAK; dataXY.DISKX = _Data.XYData[i].DISKX; dataXY.DISKY = _Data.XYData[i].DISKY; dataXY.DISKZ = _Data.XYData[i].DISKZ; dataXY.FLAP_0 = _Data.XYData[i].FLAP_0; dataXY.FLAP_C1 = _Data.XYData[i].FLAP_C1; dataXY.FLAP_S1 = _Data.XYData[i].FLAP_S1; dataXY.HDISK = _Data.XYData[i].HDISK; dataXY.INVERSE = _Data.XYData[i].INVERSE; dataXY.MU = _Data.XYData[i].MU; dataXY.N_BLADE = _Data.XYData[i].N_BLADE; dataXY.OMIGA = _Data.XYData[i].OMIGA; dataXY.PITCH_0 = _Data.XYData[i].PITCH_0; dataXY.PITCH_C = _Data.XYData[i].PITCH_C; dataXY.PITCH_S = _Data.XYData[i].PITCH_S; dataXY.RADIUS = _Data.XYData[i].RADIUS; dataXY.RADIUSC = _Data.XYData[i].RADIUSC; dataXY.TWSIT = _Data.XYData[i].TWSIT; dataXY.BLADE = _Data.XYData[i].BLADE; item.Tag = dataXY; //this.treeViewXY.Nodes.Add(node); this.XYlistView.Items.Add(item); if (i == 0) { //默认加载首结点 //this.treeViewXY.SelectedNode = node; item.Selected=true; this.loadYXGridFormNodeTag((sXY)item.Tag); } } #region 进气道 this.MASSOUT_RATE.Text = _Data.inlet.MASSOUT_RATE; this.TEMP_OUT0.Text = _Data.inlet.TEMP_OUT0; #endregion bool flag = true; if (this.XYlistView.Items.Count == 0) { flag = false; } this.btnEditXY.Enabled = flag; this.btnDelXY.Enabled = flag; this.gbYSJ.Enabled = flag; this.groupBox1.Enabled = flag; }
private void btnAddXY_Click(object sender, EventArgs e) { if (!checkXY()) { return; } ListViewItem item = new ListViewItem(); //item.BackColor = Color.LightSteelBlue; string name = "0"; if (this.XYlistView.Items.Count != 0) { name = this.XYlistView.Items[this.XYlistView.Items.Count - 1].Text; name = (Convert.ToInt32(name.Substring(name.Length - 1)) + 1).ToString(); } item.Text = "旋翼" + name;// this.XYlistView.Items.Count; sXY dataXY = new sXY(); dataXY.ALF_TPP = this.tbALF_TPP.Text; dataXY.CHORD = this.tbCHORD.Text; dataXY.DISKAK = Common.cmbdiskToDiskak(this.cmbDISKAK.SelectedIndex); dataXY.DISKX = this.tbDISKX.Text; dataXY.DISKY = this.tbDISKY.Text; dataXY.DISKZ = this.tbDISKZ.Text; dataXY.FLAP_0 = this.tbFLAP_0.Text; dataXY.FLAP_C1 = this.tbFLAP_C1.Text; dataXY.FLAP_S1 = this.tbFLAP_S1.Text; dataXY.HDISK = this.tbHDISK.Text; dataXY.INVERSE = this.cmbINVERSE.SelectedIndex; dataXY.MU = this.tbMU.Text; dataXY.N_BLADE = this.tbN_BLADE.Text; dataXY.OMIGA = this.tbOMIGA.Text; dataXY.PITCH_0 = this.tbPITCH_0.Text; dataXY.PITCH_C = this.tbPITCH_C.Text; dataXY.PITCH_S = this.tbPITCH_S.Text; dataXY.RADIUS = this.tbRADIUS.Text; dataXY.RADIUSC = this.tbRADIUSC.Text; dataXY.TWSIT = this.tbTWSIT.Text; dataXY.BLADE = string.Empty; for (int i = 0; i < this.dgvYX.Rows.Count; i++) { for (int j = 0; j < this.dgvYX.Columns.Count; j++) { if (j == 0) { dataXY.BLADE = dataXY.BLADE + this.dgvYX.Rows[i].Cells[j].Value.ToString(); } else { dataXY.BLADE = dataXY.BLADE + "#" + this.dgvYX.Rows[i].Cells[j].Value.ToString(); } } if (i < this.dgvYX.Rows.Count - 1) { dataXY.BLADE = dataXY.BLADE + "|"; } } item.Tag = dataXY; this.XYlistView.Items.Add(item); item.Selected = true; this.btnEditXY.Enabled = true; this.btnDelXY.Enabled = true; this.gbYSJ.Enabled = true; this.groupBox1.Enabled = true; }