private void edit() { if (dataGridView1.CurrentCell != null && dataGridView1.CurrentCell.RowIndex >= 0 && dataGridView1.CurrentCell.RowIndex < _dataTable.Rows.Count) { ILimnorDesignPane pane = _prj.GetTypedData <ILimnorDesignPane>(_method.ClassId); ActionItem ai = _dataTable.Rows[dataGridView1.CurrentCell.RowIndex][0] as ActionItem; List <IAction> actList = DesignUtil.SelectAction(pane.Loader, ai.Action, null, false, _method, _method.CurrentActionsHolder, this.FindForm()); if (actList != null && actList.Count > 0) { ai = new ActionItem(actList[0]); _dataTable.Rows[dataGridView1.CurrentCell.RowIndex][0] = ai; } } }
private void btAdd_Click(object sender, EventArgs e) { ILimnorDesignPane pane = _prj.GetTypedData <ILimnorDesignPane>(_method.ClassId); if (pane != null) { List <IAction> actList = DesignUtil.SelectAction(pane.Loader, null, null, true, _method, _method.CurrentActionsHolder, this.FindForm()); if (actList != null && actList.Count > 0) { foreach (IAction act in actList) { _dataTable.Rows.Add(new ActionItem(act)); } } } }
protected override void OnReplaceAction() { MethodDiagramViewer mv = this.Parent as MethodDiagramViewer; if (mv != null) { ISingleAction av = this.ActionObject as ISingleAction; List <IAction> actReplaceList = DesignUtil.SelectAction(mv.DesignerHolder.Loader, av.ActionData, null, false, mv.DesignerHolder.Method, mv.ActionsHolder, this.FindForm()); if (actReplaceList != null && actReplaceList.Count > 0) { av.ActionId = new TaskID(actReplaceList[0].WholeActionId); av.ActionData = actReplaceList[0]; IMethodDiagram p = this.Parent as IMethodDiagram; if (p != null) { p.OnActionNameChanged(av.ActionData.ActionName, av.ActionId.WholeTaskId); } } } }
private void edit(int idx) { if (dataGridView1.CurrentCell != null && dataGridView1.CurrentCell.RowIndex >= 0 && dataGridView1.CurrentCell.RowIndex < _dataTable.Rows.Count) { if (idx == 0) { Rectangle rc = dataGridView1.GetCellDisplayRectangle(dataGridView1.CurrentCell.ColumnIndex, dataGridView1.CurrentCell.RowIndex, true); MathNodeRoot r = _dataTable.Rows[dataGridView1.CurrentCell.RowIndex][0] as MathNodeRoot; r.ScopeMethod = _method; r.Project = _prj; dlgMathEditor dlg = new dlgMathEditor(this.Parent.RectangleToScreen(rc)); dlg.MathExpression = r; dlg.SetScopeMethod(_method); if (dlg.ShowDialog(this.FindForm()) == DialogResult.OK) { r = (MathNodeRoot)dlg.MathExpression; _dataTable.Rows[dataGridView1.CurrentCell.RowIndex][0] = r; } } else { ActionList aList = _dataTable.Rows[dataGridView1.CurrentCell.RowIndex][1] as ActionList; ILimnorDesignPane pane = _prj.GetTypedData <ILimnorDesignPane>(_method.ClassId); if (aList == null || aList.Count == 0) { List <IAction> actList = DesignUtil.SelectAction(pane.Loader, null, null, true, _method, _method.CurrentActionsHolder, this.FindForm()); if (actList != null && actList.Count > 0) { aList = new ActionList(); aList.Name = "Actions"; // actList[0].ToString(); foreach (IAction act in actList) { aList.Add(new ActionItem(act)); } _dataTable.Rows[dataGridView1.CurrentCell.RowIndex][1] = aList; } else { return; } } IMethodDialog imd = this.FindForm() as IMethodDialog; MethodDesignerHolder v = null; if (imd != null) { v = imd.GetEditor(); } DlgActionList dlg = new DlgActionList(); dlg.LoadData(aList, _method, _prj, v); if (dlg.ShowDialog(this.FindForm()) == DialogResult.OK) { aList = dlg.Result; _dataTable.Rows[dataGridView1.CurrentCell.RowIndex][1] = aList; if (v != null) { MethodDiagramViewer mv = v.GetCurrentViewer(); foreach (ActionItem a in aList) { if (a.Action != null && a.Action.Changed) { if (!mv.ChangedActions.ContainsKey(a.ActionId)) { mv.ChangedActions.Add(a.ActionId, a.Action); } } } } } else { foreach (ActionItem a in aList) { if (a.Action != null && a.Action.Changed) { a.Action.ReloadFromXmlNode(); } } } } } }