Beispiel #1
0
        public List <ViewModelComponentLine> GetAllLineWithConnectionOfLines(BaseViewModelComponent element)
        {
            var lines = new List <ViewModelComponentLine>();

            foreach (var pin in element.GetElementModel().GetAllPins())
            {
                foreach (var coPin in pin.GetAllCoWorker())
                {
                    if (FindElementId(coPin.GetParentId()).Name == ETypeOfElement.Line)
                    {
                        lines.Add((ViewModelComponentLine)FindViewModelId(coPin.GetParentId()));
                    }
                }
            }
            return(lines);
        }
Beispiel #2
0
        private void CreateInput(Point point, Canvas surface, int id = -1, string text = "")
        {
            ComponentUIInput componentUi;
            ElementInput     element;
            ElementLabel     elementLabel;

            var labelVM = new ViewModelLabel();

            if (id < 0)
            {
                componentUi  = new ComponentUIInput(point, BaseElement.IdCounter);
                element      = new ElementInput(BaseElement.IdCounter);
                elementLabel = new ElementLabel(BaseElement.IdCounter);
                text         = "Подпись";
            }
            else
            {
                componentUi  = new ComponentUIInput(point, id);
                element      = new ElementInput(id);
                elementLabel = new ElementLabel(id);
            }
            BaseViewModelComponent baseViewModelComponent = new BaseViewModelComponent {
                element = element
            };

            baseViewModelComponent.strength = text;
            componentUi.DataContext         = element;
            surface.Children.Add(componentUi);
            componentUi.OnPinDropped     += baseViewModelComponent.OnPinDrop;
            componentUi.OnDeleteElement  += baseViewModelComponent.OnDelete;
            labelVM.element               = elementLabel;
            componentUi.Label.DataContext = baseViewModelComponent;
            componentUi.Label.OnEdit     += baseViewModelComponent.OnEdit;
            _elements.Add(baseViewModelComponent);
            _elements[_elements.Count - 1].OnPinElementDropped += OnElementPinDropped;
            _elements[_elements.Count - 1].OnElementDelete     += Delete;
        }