A signal.
Inheritance: System.EventArgs
Esempio n. 1
0
 /// <summary>
 ///     Removes a signal.
 /// </summary>
 /// <param name="signal">The signal.</param>
 public static void RemoveSignal(Signal signal)
 {
     if (Signals.Contains(signal))
     {
         Signals.Remove(signal);
     }
 }
Esempio n. 2
0
 /// <summary>
 ///     Adds a signal.
 /// </summary>
 /// <param name="signal">The signal.</param>
 public static void AddSignal(Signal signal)
 {
     if (!Signals.Contains(signal))
     {
         Signals.Add(signal);
     }
 }
Esempio n. 3
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="RaisedArgs" /> class.
 /// </summary>
 /// <param name="reason">
 ///     The Reason
 /// </param>
 /// <param name="signal">
 ///     The Signal
 /// </param>
 public RaisedArgs(string reason, Signal signal)
 {
     this.Reason = reason;
     this.Signal = signal;
 }
Esempio n. 4
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="GlobalSignalRaisedArgs" /> class.
 /// </summary>
 /// <param name="reason">The reason.</param>
 /// <param name="signal">The signal.</param>
 internal GlobalSignalRaisedArgs(string reason, Signal signal)
 {
     this.Reason = reason;
     this.Signal = signal;
 }
Esempio n. 5
0
        /// <summary>
        ///     Creates an instance of the <see cref="Signal" /> class.
        /// </summary>
        /// <param name="onRaised">The delegate to call when this signal is raised.</param>
        /// <param name="signalWaver">The function that returns <c>true</c> when this signal should be waved.</param>
        /// <param name="expiration">The expiration of this signal.</param>
        /// <param name="defaultProperties">A dictionary that contents will be dumped into <see cref="Properties" /></param>
        /// <returns>The <see cref="Signal" /></returns>
        public static Signal Create(
            OnRaisedDelegate onRaised = null, 
            SignalWaverDelegate signalWaver = null, 
            DateTimeOffset expiration = default(DateTimeOffset), 
            IDictionary<string, object> defaultProperties = null)
        {
            if (expiration == default(DateTimeOffset))
            {
                expiration = DateTimeOffset.MaxValue;
            }

            var signal = new Signal(
                onRaised, 
                signalWaver, 
                expiration, 
                defaultProperties ?? new Dictionary<string, object>());

            SignalManager.AddSignal(signal);
            signal.Enabled = true;

            return signal;
        }
Esempio n. 6
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="RaisedArgs" /> class.
 /// </summary>
 /// <param name="reason">
 ///     The Reason
 /// </param>
 /// <param name="signal">
 ///     The Signal
 /// </param>
 public RaisedArgs(string reason, Signal signal)
 {
     this.Reason = reason;
     this.Signal = signal;
 }
Esempio n. 7
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="GlobalSignalRaisedArgs" /> class.
 /// </summary>
 /// <param name="reason">The reason.</param>
 /// <param name="signal">The signal.</param>
 internal GlobalSignalRaisedArgs(string reason, Signal signal)
 {
     this.Reason = reason;
     this.Signal = signal;
 }