private void fpInterfaces_ButtonClicked(object sender, EditorNotifyEventArgs e) { DialogResult dr = openFileDialog.ShowDialog(); if (dr == DialogResult.OK) { string dllName = openFileDialog.SafeFileName; List <Type> typeList = null; typeList = ReflectionManager.GetTypesByInterfaceWithOutAbstract(dllName, InterfaceType, TypeOfType.Class); if (typeList == null || typeList.Count == 0) { return; } SetHyperLinkCellTypeCellText(fpInterfaces_Sheet1.Cells[e.Row, e.Column], dllName); IDatasAskerImplementor iDatasAskerImplementor = fpInterfaces_Sheet1.Rows[e.Row].Tag as IDatasAskerImplementor; iDatasAskerImplementor.DllName = dllName; string[] types = new string[typeList.Count]; for (int i = 0; i < typeList.Count; i++) { types[i] = typeList[i].FullName; } comboBoxCellType.Items = types; fpInterfaces_Sheet1.Cells[e.Row, 1].CellType = comboBoxCellType.Clone() as FarPoint.Win.Spread.CellType.ComboBoxCellType; fpInterfaces_Sheet1.Cells[e.Row, 1].Locked = false; } }
public void Delete() { Cell cell = fpInterfaces_Sheet1.ActiveCell; if (cell == null) { return; } IDatasAskerImplementor iDatasAskerImplementor = fpInterfaces_Sheet1.Rows[cell.Row.Index].Tag as IDatasAskerImplementor; //如果为非空的接口设置,才弹出确认删除询问。 if (iDatasAskerImplementor.DllName != string.Empty && iDatasAskerImplementor.ClassName != string.Empty && iDatasAskerImplementor.Value != string.Empty) { DialogResult dr = MessageBox.Show("确认要删除 " + iDatasAskerImplementor.DllName + " 下的 " + iDatasAskerImplementor.ClassName + " 吗?", "删除ISystemValue", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr != DialogResult.Yes) { return; } } if (interfaceSetting.IDatasAskerImplementorList.Contains(iDatasAskerImplementor)) { interfaceSetting.IDatasAskerImplementorList.Remove(iDatasAskerImplementor); } fpInterfaces_Sheet1.Rows.Remove(cell.Row.Index, 1); if (Changed != null) { Changed(this, null); } }
public void Add() { IDatasAskerImplementor iDatasAskerImplementor = new IDatasAskerImplementor(); //添加至FP。此时先不将iDatasAskerImplementor添加至interfaceSetting.IDatasAskerImplementorList中。在FP的EditChange进行添加。 //因为只有在选择一个完成的接口实现类之后才会触发EditChange事件,此时再将新添加的接口实现类添加至interfaceSetting.IDatasAskerImplementorList才有意义。 Add(iDatasAskerImplementor); if (Changed != null) { Changed(this, null); } }
public int CheckInput() { fpInterfaces.StopCellEditing(); int sortID = 0; for (int i = 0; i < fpInterfaces_Sheet1.Rows.Count; i++) { IDatasAskerImplementor iDatasAskerImplementor = fpInterfaces_Sheet1.Rows[i].Tag as IDatasAskerImplementor; if (iDatasAskerImplementor.DllName != string.Empty && iDatasAskerImplementor.ClassName != string.Empty) { iDatasAskerImplementor.SortID = sortID; sortID++; } } return(1); }
private void fpInterfaces_EditChange(object sender, EditorNotifyEventArgs e) { if (e.Column == 1) { IDatasAskerImplementor iDatasAskerImplementor = fpInterfaces_Sheet1.Rows[e.Row].Tag as IDatasAskerImplementor; iDatasAskerImplementor.ClassName = fpInterfaces_Sheet1.Cells[e.Row, 1].Text; if (!interfaceSetting.IDatasAskerImplementorList.Contains(iDatasAskerImplementor)) { interfaceSetting.IDatasAskerImplementorList.Add(iDatasAskerImplementor); } fpInterfaces_Sheet1.Cells[e.Row, 1].CellType = comboBoxCellType.Clone() as FarPoint.Win.Spread.CellType.ComboBoxCellType; fpInterfaces_Sheet1.Cells[e.Row, 2].Locked = false; } else if (e.Column == 2) { IDatasAskerImplementor iDatasAskerImplementor = fpInterfaces_Sheet1.Rows[e.Row].Tag as IDatasAskerImplementor; iDatasAskerImplementor.Value = fpInterfaces_Sheet1.Cells[e.Row, 2].Text; } }
private void Add(IDatasAskerImplementor iDatasAskerImplementor) { fpInterfaces_Sheet1.Rows.Count++; int lastRowIndex = fpInterfaces_Sheet1.Rows.Count - 1; fpInterfaces_Sheet1.Rows[lastRowIndex].Tag = iDatasAskerImplementor; if (iDatasAskerImplementor.DllName == string.Empty) { fpInterfaces_Sheet1.Cells[lastRowIndex, 0].Value = "单击选择文件"; } else { fpInterfaces_Sheet1.Cells[lastRowIndex, 0].Value = iDatasAskerImplementor.DllName; fpInterfaces_Sheet1.Cells[lastRowIndex, 2].Locked = false; } fpInterfaces_Sheet1.Cells[lastRowIndex, 1].Value = iDatasAskerImplementor.ClassName; fpInterfaces_Sheet1.Cells[lastRowIndex, 2].Value = iDatasAskerImplementor.Value; Cell cell = fpInterfaces_Sheet1.Cells[lastRowIndex, 0]; SetHyperLinkCellTypeCellText(cell, cell.Value.ToString()); }