protected override void OnImportAction() { base.OnImportAction(); AB_ActionList av = this.ActionObject as AB_ActionList; if (av != null) { ActionName = av.Name; Description = av.Description; } else { DesignUtil.WriteToOutputWindowAndLog("Decision table not found"); } }
protected virtual void OnPaintAction(PaintEventArgs e) { int nLeft = 0; //draw action AB_ActionList av = this.ActionObject as AB_ActionList; if (ActionImage == null) { SetActionImage(Resources.actionList); } Bitmap img = ActionImage; switch (av.IconLayout) { case EnumIconDrawType.Fill: if (this.Size.Width > 4 && this.Size.Height > 4) { e.Graphics.DrawImage(img, 1, 1, this.Size.Width - 4, this.Size.Height - 4); nLeft = 1; } break; case EnumIconDrawType.Left: e.Graphics.DrawImage(img, 1, (this.Size.Height - img.Height) / 2, img.Size.Width, img.Size.Height); nLeft = 1 + img.Width; break; case EnumIconDrawType.Center: e.Graphics.DrawImage(img, (this.Size.Width - img.Width) / 2, (this.Size.Height - img.Height) / 2, img.Size.Width, img.Size.Height); nLeft = 1; break; } SizeF sz = e.Graphics.MeasureString(this.ActionDisplay, TextFont); float x = (Size.Width - sz.Width - nLeft) / 2 + nLeft; float y = (Size.Height - sz.Height) / 2; if (x < 0) { x = 0; } if (y < 0) { y = 0; } e.Graphics.DrawString(this.ActionDisplay, TextFont, TextBrush, x, y); }
protected override void OnEditAction() { MethodDiagramViewer mv = this.DiagramViewer; if (mv != null) { AB_ActionList av = this.ActionObject as AB_ActionList; ActionList aList = av.Actions; DlgActionList dlg = new DlgActionList(); dlg.LoadData(aList, mv.Method, mv.Project, mv.DesignerHolder); Form f = this.FindForm(); #if DEBUG MathNode.Trace("Showing dialog"); #endif if (dlg.ShowDialog(f) == DialogResult.OK) { av.Actions = dlg.Result; mv.Changed = true; 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(); } } } } }