Beispiel #1
0
        public void MouseDown(Vector2 mouseFieldPos)
        {
            _mouseDownPos = ToDiscret(mouseFieldPos);
            foreach (var streamingVis in StreamingComponents)
            {
                if (streamingVis.Hit(mouseFieldPos))
                {
                    int pin;
                    if (streamingVis.MouseSelectInput(_mouseDownPos, out pin))
                    {
                        _wireCreator = new InputWireCreator(streamingVis, pin, EmploymentMatrix);
                        Childrens.Insert(0, _wireCreator.Wire);
                        return;
                    }
                    if (streamingVis.MouseSelectOutput(_mouseDownPos, out pin))
                    {
                        _wireCreator = new OutputWireCreator(streamingVis, pin, EmploymentMatrix);
                        Childrens.Insert(0, _wireCreator.Wire);
                        return;
                    }

                    _dragStreamingVisual  = new MouseDragVisualObject(streamingVis, _mouseDownPos);
                    streamingVis.IsSelect = !streamingVis.IsSelect;
                    return;
                }
            }
            SelectRectangle.Translate = ToDiscret(mouseFieldPos);
            SelectRectangle.IsVisible = true;
            SelectRectangle.Shape     = new Vector2[0];
        }
        private EventPanelViewmodelBase PlaceEventInRundown(IEvent e, bool show)
        {
            EventPanelViewmodelBase newVm = null;
            EventPanelViewmodelBase evm   = Find(e, true);

            if (evm == null)
            {
                var vp = e.GetVisualParent();
                if (vp != null)
                {
                    var evmVp = Find(vp, true);
                    if (evmVp != null)
                    {
                        var eventType = e.EventType;
                        if (eventType == TEventType.Movie || eventType == TEventType.Rundown || eventType == TEventType.Live ||
                            evmVp.IsExpanded)
                        {
                            if (evmVp.IsExpanded || show || e == EngineViewmodel.LastAddedEvent)
                            {
                                evmVp.IsExpanded = true;
                                if (evmVp.Find(e, true) == null) // find again after expand
                                {
                                    if (e.Parent == vp)          // StartType = With
                                    {
                                        newVm = evmVp.CreateChildEventPanelViewmodelForEvent(e);
                                        evmVp.Childrens.Insert(0, newVm);
                                    }
                                    else // StartType == After
                                    {
                                        var prior = e.Prior;
                                        if (prior != null)
                                        {
                                            var evmPrior = evmVp.Find(prior, true);
                                            if (evmPrior == null)
                                            {
                                                evmPrior = PlaceEventInRundown(prior, true); // recurrence here
                                            }
                                            if (evmPrior != null)
                                            {
                                                var pos = evmVp.Childrens.IndexOf(evmPrior);
                                                newVm = evmVp.CreateChildEventPanelViewmodelForEvent(e);
                                                evmVp.Childrens.Insert(pos + 1, newVm);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!evmVp.HasDummyChild)
                            {
                                evmVp.Childrens.Add(DummyChild);
                            }
                        }
                    }
                }
                else //vp == null
                {
                    var prior = e.Prior;
                    if (prior != null)
                    {
                        var evmPrior = Find(prior, true);
                        if (evmPrior != null)
                        {
                            var pos = Childrens.IndexOf(evmPrior);
                            newVm = CreateChildEventPanelViewmodelForEvent(e);
                            Childrens.Insert(pos + 1, newVm);
                        }
                    }
                    else
                    if (e.StartType == TStartType.Manual || e.EventType == TEventType.Container)
                    {
                        newVm = AddRootEvent(e);
                    }
                }
            }
            return(newVm);
        }