public TECNetworkConnection(Guid guid, TECController parent, TECProtocol protocol) : base(guid)
 {
     this.IsTypical              = false;
     ParentController            = parent;
     this.protocol               = protocol;
     Children.CollectionChanged += Children_CollectionChanged;
 }
Ejemplo n.º 2
0
        public TECNetworkConnection AddNetworkConnection(TECProtocol protocol)
        {
            if (!CanAddNetworkConnection(protocol))
            {
                return(null);
            }
            TECNetworkConnection netConnect = new TECNetworkConnection(this, protocol);

            this.ChildrenConnections.Add(netConnect);
            return(netConnect);
        }
 public void SetProtocol(TECProtocol prot)
 {
     if (this.protocol != prot)
     {
         var old          = this.protocol;
         var originalCost = CostBatch;
         this.protocol = prot;
         notifyCombinedChanged(Change.Edit, "Protocol", this, prot, old);
         notifyCostChanged(CostBatch - originalCost);
     }
 }
 public TECNetworkConnection(TECNetworkConnection connectionSource, TECController parent, Dictionary <Guid, Guid> guidDictionary = null)
     : base(connectionSource, guidDictionary)
 {
     Children.CollectionChanged += Children_CollectionChanged;
     foreach (IConnectable item in connectionSource.Children)
     {
         IConnectable newChild = item.Copy(guidDictionary);
         newChild.SetParentConnection(this);
         _children.Add(newChild);
     }
     ParentController = parent;
     this.protocol    = connectionSource.protocol;
 }
Ejemplo n.º 5
0
 private bool remove(TECProtocol protocol)
 {
     if (protocolDictionary.ContainsKey(protocol))
     {
         TECIO io = protocolDictionary[protocol];
         io.Quantity--;
         if (io.Quantity < 1)
         {
             protocolDictionary.Remove(io.Protocol);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 6
0
 public static IOCollection ToIOCollection(this TECProtocol protocol)
 {
     return(new IOCollection(new List <TECIO> {
         new TECIO(protocol)
     }));
 }
Ejemplo n.º 7
0
 public void Add(TECProtocol protocol)
 {
     this.Add(new TECIO(protocol));
 }
Ejemplo n.º 8
0
 public bool Contains(TECProtocol protocol)
 {
     return(this.Contains(new TECIO(protocol)));
 }
Ejemplo n.º 9
0
 public IOCollection(TECProtocol protocol) : this(new TECIO(protocol))
 {
 }
Ejemplo n.º 10
0
 public TECIO(TECIO ioSource) : this(ioSource.Type)
 {
     _quantity = ioSource.Quantity;
     _protocol = ioSource.Protocol;
 }
Ejemplo n.º 11
0
 public TECIO(TECProtocol protocol) : this(Guid.NewGuid(), protocol)
 {
 }
Ejemplo n.º 12
0
 public TECIO(Guid guid, TECProtocol protocol) : this(guid, IOType.Protocol)
 {
     _protocol = protocol ?? throw new Exception();
 }
Ejemplo n.º 13
0
 public bool CanAddNetworkConnection(TECProtocol protocol)
 {
     return(AvailableProtocols.Contains(protocol));
 }
 public TECNetworkConnection(TECController parent, TECProtocol protocol) : this(Guid.NewGuid(), parent, protocol)
 {
 }