public void Draw(Event eEvent, Action action) { foreach (var actionControl in actionControls) { foreach (var eventControl in eventControls) { if (eEvent == eventControl.DataContext && action == actionControl.DataContext) { DLine dLine = new DLine(); dLine.ActionControl = actionControl; dLine.EventControl = eventControl; dLine.ActionIsMain = false; layer.DLines.Add(dLine); Gridt.Children.Add(dLine.GetLine()); break; } } } foreach (var dLine in layer.DLines) { dLine.RefreshLine(); } }
public void ShowElements() { ActionControl actC; int x = 0; int X0 = 10; int Y0 = 10; foreach (var act in layer.Actions) { x++; actC = new ActionControl { Name = "act" + x.ToString(), DataContext = act, Margin = new Thickness(X0, Y0, 0, 0) }; actC.MouseDown += Control_MouseDown; actC.MouseUp += Control_MouseUp; Y0 += 250; actionControls.Add(actC); } X0 = 200; Y0 = 10; eventControls = new List<EventControl>(); foreach (var action in layer.Actions) foreach (var eventOrigin in layer.EventOrigins) { Event eEvent = new Event(); EventControl eventControl = new EventControl(); eventControl.MouseDown += Control_MouseDown; eventControl.MouseUp += Control_MouseUp; eEvent.ParentAction = action; eEvent.EventOrigin = eventOrigin; eventControl.DataContext = eEvent; eventControl.Margin = new Thickness(X0, Y0, 0, 0); layer.Events.Add(eEvent); action.ChildEvents.Add(eEvent); eventControls.Add(eventControl); Y0 += 200; } Addlines(); AddeventsControl(); AddactionControl(); }