示例#1
0
 public BaseComponentUI(Point point, ETypeOfElement nameElement, int id)
 {
     Margin      = new Thickness(point.X, point.Y, 0, 0);
     Construct   = false;
     NameElement = nameElement;
     ID          = id;
     AllowDrop   = true;
 }
示例#2
0
        private void CreateComponent(ETypeOfElement name, Point point, int id, string text)
        {
            BaseViewModelComponent newComponent;

            if (name == ETypeOfElement.Input)
            {
                CreateInput(point, _surface, id, text);
            }
            switch (name)
            {
            case ETypeOfElement.And:
                newComponent = new GenericViewModelComponent <ComponentUIAnd, ElementAnd>(point, _surface, id);
                break;

            case ETypeOfElement.AndNot:
                newComponent = new GenericViewModelComponent <ComponentUIAndNot, ElementAndNot>(point, _surface, id);
                break;

            case ETypeOfElement.Output:
                newComponent = new GenericViewModelComponent <ComponentUIOutput, ElementOutput>(point, _surface, id);
                break;

            case ETypeOfElement.Or:
                newComponent = new GenericViewModelComponent <ComponentUIOr, ElementOr>(point, _surface, id);
                break;

            case ETypeOfElement.OrNot:
                newComponent = new GenericViewModelComponent <ComponentUIOrNot, ElementOrNot>(point, _surface, id);
                break;

            case ETypeOfElement.Xor:
                newComponent = new GenericViewModelComponent <ComponentUIXor, ElementXor>(point, _surface, id);
                break;

            case ETypeOfElement.XorNot:
                newComponent = new GenericViewModelComponent <ComponentUIXorNot, ElementXorNot>(point, _surface, id);
                break;

            case ETypeOfElement.Check:
                newComponent = new GenericViewModelComponent <ComponentUICheck, ElementCheck>(point, _surface, id);
                break;

            case ETypeOfElement.Not:
                newComponent = new GenericViewModelComponent <ComponentUINot, ElementNot>(point, _surface, id);
                break;

            case ETypeOfElement.Label:
                newComponent = new ViewModelLabel(point, _surface, id);
                break;

            default:
                return;
            }
            newComponent.strength = text;
            _elements.Add(newComponent);
            _elements[_elements.Count - 1].OnPinElementDropped += OnElementPinDropped;
            _elements[_elements.Count - 1].OnElementDelete     += Delete;
        }
示例#3
0
 public BaseComponentUI(ETypeOfElement nameElement)
 {
     Construct   = true;
     AllowDrop   = true;
     NameElement = nameElement;
 }