Exemple #1
0
 private void _Attach(Adsorber <T> asadsorber)
 {
     if (_Bind(asadsorber) == false)
     {
         _UnusedAdsorbers.Add(asadsorber);
     }
 }
Exemple #2
0
        public void Detach <T>(Adsorber <T> adsorber)
        {
            var notifier  = _Agent.QueryNotifier <T>();
            var notifier1 = _QueryNotifier(notifier);

            notifier1.Unregister(adsorber);
        }
Exemple #3
0
        private bool _Bind(Adsorber <T> adsorber)
        {
            var gpi = _UnusedGpis.FirstOrDefault();

            if (gpi != null)
            {
                _Bind(adsorber, gpi);
                _UnusedGpis.Remove(gpi);
                return(true);
            }
            return(false);
        }
Exemple #4
0
        private void _Unbind(Adsorber <T> adsorber)
        {
            var binded = _Bindeds.FirstOrDefault(b => b.Adsorber.GetHashCode() == adsorber.GetHashCode());

            if (binded == null)
            {
                return;
            }

            binded.Adsorber.Unsupply(binded.Gpi);
            _Bindeds.Remove(binded);
            _Attach(binded.Gpi);
        }
 public abstract void Unregister <T>(Adsorber <T> adsorber);
Exemple #6
0
 private void _Bind(Adsorber <T> adsorber, T gpi)
 {
     adsorber.Supply(gpi);
     _Bindeds.Add(new Binded(adsorber, gpi));
 }
Exemple #7
0
        public override void Register <T1>(Adsorber <T1> adsorber)
        {
            var asadsorber = adsorber as Adsorber <T>;

            _Attach(asadsorber);
        }
Exemple #8
0
 public Binded(Adsorber <T> adsorber, T gpi)
 {
     Adsorber = adsorber;
     Gpi      = gpi;
 }
Exemple #9
0
 public override void Unregister <T1>(Adsorber <T1> adsorber)
 {
     _UnusedAdsorbers.RemoveAll(a => a.GetHashCode() == adsorber.GetHashCode());
     _Unbind(adsorber as Adsorber <T>);
 }