Beispiel #1
0
 private void sourcesRegisteredSourceSignalNameChanged(ISignalSource signal, string newName, List <object> recursionChain = null)
 {
     if (recursionChain?.Contains(this) == true)
     {
         return;
     }
     RegisteredSourceSignalNameChanged?.Invoke(this, newName, recursionChain.ExtendRecursionChain(this));
 }
        protected override void afterNameChange()
        {
            base.afterNameChange();
            SignalLabelChanged?.Invoke(this, SignalLabel);
            RaisePropertyChanged(nameof(ISignalSourceRegistered.SignalLabel));
            List <object> recursionChain = new List <object>();

            recursionChain.Add(this);
            RegisteredSourceSignalNameChanged?.Invoke(this, Name, recursionChain);
            RaisePropertyChanged(nameof(RegisteredSourceSignalName));
        }
Beispiel #3
0
        public virtual void AssignSource(ISignalSource source)
        {
            ISignalSource oldSource = currentSource;

            if (currentSource != null)
            {
                currentSource.RegisteredSourceSignalChanged     -= sourcesRegisteredSourceSignalChanged;
                currentSource.RegisteredSourceSignalNameChanged -= sourcesRegisteredSourceSignalNameChanged;
            }

            currentSource = source;
            if (currentSource != null)
            {
                currentSource.RegisteredSourceSignalChanged     += sourcesRegisteredSourceSignalChanged;
                currentSource.RegisteredSourceSignalNameChanged += sourcesRegisteredSourceSignalNameChanged;
            }

            CurrentSourceChanged?.Invoke(this, source);

            ISignalSourceRegistered currentRegisteredSourceSignal = currentSource?.RegisteredSourceSignal;
            ISignalSourceRegistered oldRegisteredSourceSignal     = oldSource?.RegisteredSourceSignal;

            if (currentRegisteredSourceSignal != oldRegisteredSourceSignal)
            {
                RegisteredSourceSignalChanged?.Invoke(this, currentRegisteredSourceSignal, RecursionChainHelpers.CreateRecursionChain(this));
            }

            string currentRegisteredSourceSignalName = currentRegisteredSourceSignal?.RegisteredSourceSignalName;
            string oldRegisteredSourceSignalName     = oldRegisteredSourceSignal?.RegisteredSourceSignalName;

            if (!string.Equals(currentRegisteredSourceSignalName, oldRegisteredSourceSignalName))
            {
                RegisteredSourceSignalNameChanged?.Invoke(this, currentRegisteredSourceSignalName, RecursionChainHelpers.CreateRecursionChain(this));
            }

            ((BidirectionalPassthroughSignalTally)RedTally).PreviousElement    = source?.RedTally;
            ((BidirectionalPassthroughSignalTally)YellowTally).PreviousElement = source?.YellowTally;
            ((BidirectionalPassthroughSignalTally)GreenTally).PreviousElement  = source?.GreenTally;
        }