public void BuildGraphDoc(GraphDoc gDoc, ImageList imgList) { gDoc.ClearAll(); gDoc.BeginUpdate(); GraphUnit selectedUnit = null; int num = 0; foreach (Actdef actdef in this.Prodef.Actdefs.Values) { int xPos; int yPos; try { xPos = actdef.XPos; yPos = actdef.YPos; } catch { xPos = 0; yPos = num; } gDoc.AddNode(xPos, yPos, imgList, (int) actdef.Type, this.GetNodeType(actdef.Type)); gDoc.SelectedUnit.RelationalID = actdef.Id; gDoc.SelectedUnit.Name = actdef.Name; num += 0x20; if (actdef.IsDefaultInit) { selectedUnit = gDoc.SelectedUnit; } } foreach (Transition transition in this.mWFTRANSITIONs.Values) { Pen pen = new Pen(Color.Black, 2f); try { gDoc.AddArrowLine(this.GetNodeByRelationalID(gDoc, transition.From.Id), this.GetNodeByRelationalID(gDoc, transition.To.Id), pen.Color, (int) pen.Width); gDoc.SelectedUnit.RelationalID = transition.Id; gDoc.SelectedUnit.Name = transition.Name; } catch { } } if (selectedUnit != null) { gDoc.SelectedUnit = selectedUnit; } gDoc.EndUpdate(); selectedUnit = null; }
private void BuildGraphDoc(GraphDoc gDoc, ImageList imgList) { gDoc.ClearAll(); gDoc.BeginUpdate(); GraphUnit selectedUnit = null; int num = 0; foreach (Actdef actdef in this.Prodef.Actdefs.Values) { int xPos; int yPos; try { xPos = actdef.XPos; yPos = actdef.YPos; } catch { xPos = 0; yPos = num; } if (LoggingService.IsDebugEnabled) { LoggingService.DebugFormatted("添加结点:{0}...", new object[] { actdef.Name }); } gDoc.AddNode(xPos, yPos, imgList, (int) actdef.Type, this.GetNodeType(actdef.Type)); gDoc.SelectedUnit.RelationalID = actdef.Id; if (actdef.Type != ActdefType.INTERACTION) { gDoc.SelectedUnit.Name = actdef.Name; } else { gDoc.SelectedUnit.Name = this.GetUnitName(actdef); } num += 0x20; if (actdef.IsDefaultInit) { selectedUnit = gDoc.SelectedUnit; } } foreach (Transition transition in this.mWFTRANSITIONs.Values) { Pen pen = new Pen(Color.Black, 2f); try { gDoc.AddArrowLine(this.GetNodeByRelationalID(gDoc, transition.From.Id), this.GetNodeByRelationalID(gDoc, transition.To.Id), pen.Color, (int) pen.Width); gDoc.SelectedUnit.RelationalID = transition.Id; gDoc.SelectedUnit.Name = transition.Name; } catch { } } if (selectedUnit != null) { gDoc.SelectedUnit = selectedUnit; } gDoc.EndUpdate(); selectedUnit = null; }