Example #1
0
 public void DelCont(PlcItem i) {
   _cont.Remove(i);
   if(block==i) {
     block=null;
   }
   if(i==_src) {
     owner.SetFlagI(0, true);
     _src=null;
   }
   if(_cont.Count==0) {
     owner.changed -= owner_changed;
     PLC.instance.DelVar(this);
   }
 }
Example #2
0
 public void AddCont(PlcItem i) {
   _cont.Add(i);
   PiBlock b;
   PiLink l;
   if((b= i as PiBlock)!=null) {
     block=b;
     if(block._decl!=null && block._decl.pins[owner.name].op) {
       if(ip) {
         throw new ArgumentException(string.Format("{0} already hat source {1}", owner.path, _src));
       }
       _src=i;
       owner.SetFlagI(0, false);
     }
   } else if((l=i as PiLink)!=null) {
     if(l.output==this) {
       if(ip) {
         throw new ArgumentException(string.Format("{0} already hat source {1}", owner.path, _src));
       }
       _src=i;
       owner.SetFlagI(0, false);
     }
   }
 }