public TECNetworkConnection(Guid guid, TECController parent, TECProtocol protocol) : base(guid) { this.IsTypical = false; ParentController = parent; this.protocol = protocol; Children.CollectionChanged += Children_CollectionChanged; }
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; }
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); } }
public static IOCollection ToIOCollection(this TECProtocol protocol) { return(new IOCollection(new List <TECIO> { new TECIO(protocol) })); }
public void Add(TECProtocol protocol) { this.Add(new TECIO(protocol)); }
public bool Contains(TECProtocol protocol) { return(this.Contains(new TECIO(protocol))); }
public IOCollection(TECProtocol protocol) : this(new TECIO(protocol)) { }
public TECIO(TECIO ioSource) : this(ioSource.Type) { _quantity = ioSource.Quantity; _protocol = ioSource.Protocol; }
public TECIO(TECProtocol protocol) : this(Guid.NewGuid(), protocol) { }
public TECIO(Guid guid, TECProtocol protocol) : this(guid, IOType.Protocol) { _protocol = protocol ?? throw new Exception(); }
public bool CanAddNetworkConnection(TECProtocol protocol) { return(AvailableProtocols.Contains(protocol)); }
public TECNetworkConnection(TECController parent, TECProtocol protocol) : this(Guid.NewGuid(), parent, protocol) { }