public MainWindow() { InitializeComponent(); //ui_line.Start = new Point(0, 0); //ui_line.End = new Point(50, 50); //测试数据 actor = new Actor(diagram) { acName = "abc" }; Activity activity = new Activity(actor) { ActivityName = "ddd", Pos = 100 }; actor.AddAactivity(activity); Actor act = new Actor(diagram) { acName = "cba" }; Activity activity1 = new Activity(act) { ActivityName = "1231", Pos = 300 }; act.AddAactivity(activity1); diagram.AddActors(actor); diagram.AddActors(act); Transfer transtar = new Transfer(activity,activity1); diagram.AddTransfer(transtar); ui_Diagram.DataContext = diagram; //ui_ActorListBox.ItemsSource = diagram.Actors; //ui_Transfer.ItemsSource = diagram.Transfer; }
public Activity(Actor actor) { this.actor = actor; }
//获得执行者y坐标 public double GetY(Actor actor) { int pos = actors.IndexOf(actor)+1; double y = pos * 50 - 30; return y; }
//删除执行者 public void DelActors(Actor actor) { actors.Remove(actor); }
//添加执行者 public void AddActors(Actor actor) { actors.Add(actor); }
private void ui_NewActor_Click(object sender, RoutedEventArgs e) { //tool = "添加执行者"; Actor act = new Actor(diagram) { acName = "1231" }; diagram.AddActors(act); }