/// <summary> /// 修改焦点对象 /// </summary> public void UpdateObject() { //获取焦点对象 PowerStuffList obj = FocusedObject; if (obj == null) { return; } //创建对象的一个副本 PowerStuffList objCopy = new PowerStuffList(); DataConverter.CopyTo <PowerStuffList>(obj, objCopy); //执行修改操作 using (FrmPowerStuffListDialog dlg = new FrmPowerStuffListDialog()) { dlg.Object = objCopy; //绑定副本 if (dlg.ShowDialog() != DialogResult.OK) { return; } } //用副本更新焦点对象 DataConverter.CopyTo <PowerStuffList>(objCopy, obj); //刷新表格 gridControl.RefreshDataSource(); }
/// <summary> /// 添加对象 /// </summary> public void AddObject() { //检查对象链表是否已经加载 if (ObjectList == null) { return; } //新建对象 PowerStuffList obj = new PowerStuffList(); //执行添加操作 using (FrmPowerStuffListDialog dlg = new FrmPowerStuffListDialog()) { dlg.IsCreate = true; //设置新建标志 dlg.Object = obj; if (dlg.ShowDialog() != DialogResult.OK) { return; } } //将新对象加入到链表中 ObjectList.Add(obj); //刷新表格,并将焦点行定位到新对象上。 gridControl.RefreshDataSource(); GridHelper.FocuseRow(this.gridView, obj); }
/// <summary> /// ��Ӷ��� /// </summary> public void AddObject() { //�����������Ƿ��Ѿ����� if (ObjectList == null) { return; } //�½����� PowerStuffList obj = new PowerStuffList(); //ִ����Ӳ��� using (FrmPowerStuffListDialog dlg = new FrmPowerStuffListDialog()) { dlg.IsCreate = true; //�����½���־ dlg.Object = obj; if (dlg.ShowDialog() != DialogResult.OK) { return; } } //���¶�����뵽������ ObjectList.Add(obj); //ˢ�±���������ж�λ���¶����ϡ� gridControl.RefreshDataSource(); GridHelper.FocuseRow(this.gridView, obj); }
/// <summary> /// �Ľ������ /// </summary> public void UpdateObject() { //��ȡ������� PowerStuffList obj = FocusedObject; if (obj == null) { return; } //���������һ������ PowerStuffList objCopy = new PowerStuffList(); DataConverter.CopyTo<PowerStuffList>(obj, objCopy); //ִ���IJ��� using (FrmPowerStuffListDialog dlg = new FrmPowerStuffListDialog()) { dlg.Object = objCopy; //���� if (dlg.ShowDialog() != DialogResult.OK) { return; } } //�ø������½������ DataConverter.CopyTo<PowerStuffList>(objCopy, obj); //ˢ�±�� gridControl.RefreshDataSource(); }