Exemple #1
0
        /// <summary>
        /// Publish is activating the instrument to start recording measurements and to allow listeners to start listening to such measurements.
        /// </summary>
        protected void Publish()
        {
            List <MeterListener>?allListeners = null;

            lock (Instrument.SyncObject)
            {
                if (Meter.Disposed || !Meter.AddInstrument(this))
                {
                    return;
                }

                allListeners = MeterListener.GetAllListeners();
            }

            if (allListeners is not null)
            {
                foreach (MeterListener listener in allListeners)
                {
                    listener.InstrumentPublished?.Invoke(this, listener);
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Publish is activating the instrument to start recording measurements and to allow listeners to start listening to such measurements.
 /// </summary>
 protected void Publish()
 {
     Meter.AddInstrument(this);
     MeterListener.NotifyForPublishedInstrument(this);
 }