Skip to content

Commit

Permalink
Default event delegate updaet
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianstevens committed Nov 1, 2023
1 parent deb15c9 commit c914a53
Show file tree
Hide file tree
Showing 115 changed files with 221 additions and 221 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class SerialTextFile
/// <summary>
/// A complete line of text has been read, send this to the event subscriber.
/// </summary>
public event LineReceived OnLineReceived = delegate { };
public event LineReceived OnLineReceived = default!;

#endregion Events and delegates

Expand Down
2 changes: 1 addition & 1 deletion Source/Meadow.Foundation.Core/Relays/Relay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Meadow.Foundation.Relays
public class Relay : IRelay
{
/// <inheritdoc/>
public event EventHandler<bool> OnRelayChanged = delegate { };
public event EventHandler<bool> OnRelayChanged = default!;

/// <summary>
/// Returns digital output port
Expand Down
2 changes: 1 addition & 1 deletion Source/Meadow.Foundation.Core/SamplingSensorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public abstract class SamplingSensorBase<UNIT> : ObservableBase<UNIT>, ISampling
/// <summary>
/// Event handler for updated values
/// </summary>
public event EventHandler<IChangeResult<UNIT>> Updated = delegate { };
public event EventHandler<IChangeResult<UNIT>> Updated = default!;

/// <summary>
/// Sampling cancellation token source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ public abstract class PushButtonBase : IButton, IDisposable
/// <summary>
/// Raised when a press starts
/// </summary>
public event EventHandler PressStarted = delegate { };
public event EventHandler PressStarted = default!;

/// <summary>
/// Raised when a press ends
/// </summary>
public event EventHandler PressEnded = delegate { };
public event EventHandler PressEnded = default!;

/// <summary>
/// Raised when the button is released after a press
/// </summary>
public event EventHandler Clicked = delegate { };
public event EventHandler Clicked = default!;

/// <summary>
/// Raised when the button is pressed for LongClickedThreshold or longer and then releases
/// </summary>
public event EventHandler LongClicked = delegate { };
public event EventHandler LongClicked = default!;

/// <summary>
/// Track if we created the input port in the PushButton instance (true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class LinearHallEffectTachometer
/// Event raised when the RPM change is greater than the
/// RPMChangeNotificationThreshold value.
/// </summary>
public event EventHandler<ChangeResult<float>> RPMsChanged = delegate { };
public event EventHandler<ChangeResult<float>> RPMsChanged = default!;

/// <summary>
/// Any changes to the RPMs that are greater than the RPM change
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class DigitalJoystick : IDigitalJoystick
/// <summary>
/// Raised when the digital joystick position changes
/// </summary>
public event EventHandler<ChangeResult<DigitalJoystickPosition>> Updated = delegate { };
public event EventHandler<ChangeResult<DigitalJoystickPosition>> Updated = default!;

/// <summary>
/// The PushButton class for the up digital joystick switch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public partial class AnalogLightSensor
/// <summary>
/// Raised when the value of the reading changes.
/// </summary>
public event EventHandler<IChangeResult<Illuminance>> IlluminanceUpdated = delegate { };
public event EventHandler<IChangeResult<Illuminance>> IlluminanceUpdated = default!;

/// <summary>
/// Illuminance sensor calibration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class RotaryEncoder : IRotaryEncoder
/// <summary>
/// Raised when the rotary encoder is rotated and returns a RotaryTurnedEventArgs object which describes the direction of rotation.
/// </summary>
public event EventHandler<RotaryChangeResult> Rotated = delegate { };
public event EventHandler<RotaryChangeResult> Rotated = default!;

/// <summary>
/// Returns the pin connected to the A-phase output on the rotary encoder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ public class RotaryEncoderWithButton : RotaryEncoder, IRotaryEncoderWithButton
/// <summary>
/// Raised when the button circuit is re-opened after it has been closed
/// </summary>
public event EventHandler Clicked = delegate { };
public event EventHandler Clicked = default!;

/// <summary>
/// Raised when a press ends
/// </summary>
public event EventHandler PressEnded = delegate { };
public event EventHandler PressEnded = default!;

/// <summary>
/// Raised when a press starts
/// </summary>
public event EventHandler PressStarted = delegate { };
public event EventHandler PressStarted = default!;

/// <summary>
/// Raised when the button circuit is pressed for LongPressDuration
/// </summary>
public event EventHandler LongClicked = delegate { };
public event EventHandler LongClicked = default!;

/// <summary>
/// The minimum duration for a long press
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class DipSwitch
/// <summary>
/// Raised when one of the switches is switched on or off.
/// </summary>
public event ArrayEventHandler Changed = delegate { };
public event ArrayEventHandler Changed = default!;

/// <summary>
/// Creates a new DipSwitch connected to the specified switchPins, with the InterruptMode and ResisterMode specified by the type parameters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public bool IsOn
/// <summary>
/// Raised when the switch circuit is opened or closed.
/// </summary>
public event EventHandler Changed = delegate { };
public event EventHandler Changed = default!;

/// <summary>
/// Instantiates a new SpdtSwitch object with the center pin connected to the specified digital pin, one pin connected to common/ground and one pin connected to high/3.3V.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public bool IsOn
/// <summary>
/// Raised when the switch circuit is opened or closed.
/// </summary>
public event EventHandler Changed = delegate { };
public event EventHandler Changed = default!;

/// <summary>
/// Returns the DigitalInputPort.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public partial class AnalogTemperature : SamplingSensorBase<Units.Temperature>,
/// <summary>
/// Raised when the value of the reading changes.
/// </summary>
public event EventHandler<IChangeResult<Units.Temperature>> TemperatureUpdated = delegate { };
public event EventHandler<IChangeResult<Units.Temperature>> TemperatureUpdated = default!;

///<Summary>
/// AnalogInputPort connected to temperature sensor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public abstract class NumericBase : InputBase
/// <summary>
/// Raised when the numeric value changes
/// </summary>
public override event ValueChangedHandler ValueChanged = delegate { };
public override event ValueChangedHandler ValueChanged = default!;

/// <summary>
/// Create a new NumericBase object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public abstract class TimeBase : InputBase
/// Raised if the input value changes
/// </summary>

public override event ValueChangedHandler ValueChanged = delegate { };
public override event ValueChangedHandler ValueChanged = default!;

/// <summary>
/// Create a new TimeBase object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Date : InputBase
/// <summary>
/// Raised when the date value changes
/// </summary>
public override event ValueChangedHandler ValueChanged = delegate { };
public override event ValueChangedHandler ValueChanged = default!;

/// <summary>
/// Create a new Date input object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public abstract class ListBase : InputBase
/// <summary>
/// The value changed event handler
/// </summary>
public override event ValueChangedHandler ValueChanged = delegate { };
public override event ValueChangedHandler ValueChanged = default!;

/// <summary>
/// The output display text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public class TextDisplayMenu
/// <summary>
/// Raised when the menu receives a selected input
/// </summary>
public event MenuSelectedHandler Selected = delegate { };
public event MenuSelectedHandler Selected = default!;

/// <summary>
/// Raised when a value changes
/// </summary>
public event ValueChangedHandler ValueChanged = delegate { };
public event ValueChangedHandler ValueChanged = default!;

/// <summary>
/// Raised when the user exits the menu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public abstract class ClickableControl : ThemedControl, IClickableControl
/// <summary>
/// Occurs when the clickable control is clicked.
/// </summary>
public event EventHandler Clicked = delegate { };
public event EventHandler Clicked = default!;

private bool _pressed = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class GgaDecoder : INmeaDecoder
/// <summary>
/// Position update received event.
/// </summary>
public event EventHandler<GnssPositionInfo> PositionReceived = delegate { };
public event EventHandler<GnssPositionInfo> PositionReceived = default!;

/// <summary>
/// Prefix for the GGA decoder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class GllDecoder : INmeaDecoder
/// <summary>
/// Event raised when valid GLL data is received.
/// </summary>
public event EventHandler<GnssPositionInfo> GeographicLatitudeLongitudeReceived = delegate { };
public event EventHandler<GnssPositionInfo> GeographicLatitudeLongitudeReceived = default!;

/// <summary>
/// Prefix for the GLL (Geographic position Latitude / Longitude) decoder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class GsaDecoder : INmeaDecoder
/// <summary>
/// Event raised when valid GSA data is received
/// </summary>
public event EventHandler<ActiveSatellites> ActiveSatellitesReceived = delegate { };
public event EventHandler<ActiveSatellites> ActiveSatellitesReceived = default!;

/// <summary>
/// Prefix for the GSA decoder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class GsvDecoder : INmeaDecoder
/// <summary>
/// Event raised when valid GSV data is received.
/// </summary>
public event EventHandler<SatellitesInView> SatellitesInViewReceived = delegate { };
public event EventHandler<SatellitesInView> SatellitesInViewReceived = default!;

/// <summary>
/// Current sentence being processed, 0 indicates nothing being processed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class RmcDecoder : INmeaDecoder
/// <summary>
/// Position update received event.
/// </summary>
public event EventHandler<GnssPositionInfo> PositionCourseAndTimeReceived = delegate { };
public event EventHandler<GnssPositionInfo> PositionCourseAndTimeReceived = default!;

/// <summary>
/// Prefix for the RMBC decoder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class VtgDecoder : INmeaDecoder
/// <summary>
/// Event to be raised when a course and velocity message is received and decoded.
/// </summary>
public event EventHandler<CourseOverGround> CourseAndVelocityReceived = delegate { };
public event EventHandler<CourseOverGround> CourseAndVelocityReceived = default!;

/// <summary>
/// Prefix for the VTG decoder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ public class GtkDisplay : IGraphicsDisplay, ITouchScreen
/// <summary>
/// Event fired when the display gets a mouse down
/// </summary>
public event Hardware.TouchEventHandler TouchDown = delegate { };
public event Hardware.TouchEventHandler TouchDown = default!;
/// <summary>
/// Event fired when the display gets a mouse up
/// </summary>
public event Hardware.TouchEventHandler TouchUp = delegate { };
public event Hardware.TouchEventHandler TouchUp = default!;
/// <summary>
/// Event fired when the display gets a mouse click
/// </summary>
public event Hardware.TouchEventHandler TouchClick = delegate { };
public event Hardware.TouchEventHandler TouchClick = default!;

private Window _window = default!;
private IPixelBuffer _pixelBuffer = default!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ public class WinFormsDisplay : Form, IGraphicsDisplay, ITouchScreen
/// <summary>
/// Event fired when the display gets a mouse down
/// </summary>
public event TouchEventHandler TouchDown = delegate { };
public event TouchEventHandler TouchDown = default!;
/// <summary>
/// Event fired when the display gets a mouse up
/// </summary>
public event TouchEventHandler TouchUp = delegate { };
public event TouchEventHandler TouchUp = default!;
/// <summary>
/// Event fired when the display gets a mouse click
/// </summary>
public event TouchEventHandler TouchClick = delegate { };
public event TouchEventHandler TouchClick = default!;

private readonly WinFormsPixelBuffer _buffer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ public partial class Emc2101 :
/// <summary>
/// Internal Temperature changed event
/// </summary>
public event EventHandler<IChangeResult<Temperature>> InternalTemperatureUpdated = delegate { };
public event EventHandler<IChangeResult<Temperature>> InternalTemperatureUpdated = default!;

/// <summary>
/// External Temperature changed event
/// </summary>
public event EventHandler<IChangeResult<Temperature>> ExternalTemperatureUpdated = delegate { };
public event EventHandler<IChangeResult<Temperature>> ExternalTemperatureUpdated = default!;

/// <summary>
/// Fan Speed changed event
/// </summary>
public event EventHandler<IChangeResult<AngularVelocity>> FanSpeedUpdated = delegate { };
public event EventHandler<IChangeResult<AngularVelocity>> FanSpeedUpdated = default!;

/// <summary>
/// The temperature as read by the external sensor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public partial class As1115 : IGraphicsDisplay, II2cPeripheral, IDisposable
/// <summary>
/// Event raised when any key scan button is pressed
/// </summary>
public event EventHandler<KeyScanEventArgs> KeyScanPressStarted = delegate { };
public event EventHandler<KeyScanEventArgs> KeyScanPressStarted = default!;

/// <summary>
/// Event raised when any key scan button is released
/// </summary>
public event EventHandler<KeyScanEventArgs> KeyScanPressEnded = delegate { };
public event EventHandler<KeyScanEventArgs> KeyScanPressEnded = default!;

/// <summary>
/// Readonly collection that contains all 16 key scan button objects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ public class KeyScanButton : IButton
/// <summary>
/// Raised when a press starts (the button is pushed down)
/// </summary>
public event EventHandler PressStarted = delegate { };
public event EventHandler PressStarted = default!;

/// <summary>
/// Raised when a press ends (the button is released)
/// </summary>
public event EventHandler PressEnded = delegate { };
public event EventHandler PressEnded = default!;

/// <summary>
/// Raised when the button circuit is re-opened after it has been closed (at the end of a press)
/// </summary>
public event EventHandler Clicked = delegate { };
public event EventHandler Clicked = default!;

/// <summary>
/// Raised when the button circuit is pressed for LongPressDuration
/// </summary>
public event EventHandler LongClicked = delegate { };
public event EventHandler LongClicked = default!;

/// <summary>
/// Maximum DateTime value when the button was just pushed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class DigitalOutputPort : DigitalOutputPortBase
/// <summary>
/// The SetPinState delegate
/// </summary>
public SetPinStateDelegate SetPinState = delegate { };
public SetPinStateDelegate SetPinState = default!;

/// <summary>
/// The port state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class DigitalInputPort : DigitalInputPortBase
{
private ResistorMode _resistorMode = ResistorMode.Disabled;

internal event EventHandler Disposed = delegate { };
internal event EventHandler Disposed = default!;

/// <summary>
/// The port's containing Pca9671
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public partial class Pca9671
/// </summary>
public class DigitalOutputPort : DigitalOutputPortBase
{
internal event EventHandler Disposed = delegate { };
internal event EventHandler Disposed = default!;

/// <summary>
/// The port's containing Pca9671
Expand Down
Loading

0 comments on commit c914a53

Please sign in to comment.