コード例 #1
0
 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();
     }
 }
コード例 #2
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            ActionControl actC;
            int x = 0;
            foreach (var act in layer.Actions)
            {
                x++;

                actC = new ActionControl
                    {
                        Name = "act" + x.ToString(),
                        DataContext = act,
                        Margin = new Thickness(10, 10, 0, 0)
                    };
                actC.MouseDown += Control_MouseDown;
                actC.MouseUp += Control_MouseUp;
                actionControls.Add(actC);
            }

            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;
                    layer.Events.Add(eEvent);
                    action.ChildEvents.Add(eEvent);
                    eventControls.Add(eventControl);
                }
            Addlines();
            AddeventsControl();
            AddactionControl();
        }