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

            this.ChildrenConnections.Add(netConnect);
            return(netConnect);
        }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 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;
 }
コード例 #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);
     }
 }
コード例 #6
0
 public static IOCollection ToIOCollection(this TECProtocol protocol)
 {
     return(new IOCollection(new List <TECIO> {
         new TECIO(protocol)
     }));
 }
コード例 #7
0
 public void Add(TECProtocol protocol)
 {
     this.Add(new TECIO(protocol));
 }
コード例 #8
0
 public bool Contains(TECProtocol protocol)
 {
     return(this.Contains(new TECIO(protocol)));
 }
コード例 #9
0
 public IOCollection(TECProtocol protocol) : this(new TECIO(protocol))
 {
 }
コード例 #10
0
 public TECIO(TECIO ioSource) : this(ioSource.Type)
 {
     _quantity = ioSource.Quantity;
     _protocol = ioSource.Protocol;
 }
コード例 #11
0
 public TECIO(TECProtocol protocol) : this(Guid.NewGuid(), protocol)
 {
 }
コード例 #12
0
 public TECIO(Guid guid, TECProtocol protocol) : this(guid, IOType.Protocol)
 {
     _protocol = protocol ?? throw new Exception();
 }
コード例 #13
0
 public bool CanAddNetworkConnection(TECProtocol protocol)
 {
     return(AvailableProtocols.Contains(protocol));
 }
コード例 #14
0
 public TECNetworkConnection(TECController parent, TECProtocol protocol) : this(Guid.NewGuid(), parent, protocol)
 {
 }