File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed
RealTimeWeatherMonitoringApp/Application Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ using RealTimeWeatherMonitoringApp . Domain . Common ;
2+
3+ namespace RealTimeWeatherMonitoringApp . Application . Interfaces ;
4+
5+ /// <summary>
6+ /// Notifies subscribers about changes in data of type <typeparamref name="TObserved"/>.
7+ /// </summary>
8+ /// <typeparam name="TObserved">The observed data type.</typeparam>
9+ public interface IDataChangeNotifier < TObserved >
10+ {
11+ event EventHandler < DataChangeEventArgs < TObserved > > OnDataChange ;
12+ }
Original file line number Diff line number Diff line change 1+ namespace RealTimeWeatherMonitoringApp . Application . Interfaces ;
2+
3+ /// <summary>
4+ /// Defines the ability to receive data of type <typeparamref name="TReceived"/>.
5+ /// </summary>
6+ /// <typeparam name="TReceived">The received data type.</typeparam>
7+ public interface IDataReceiver < in TReceived >
8+ {
9+ void Receive ( TReceived data ) ;
10+ }
Original file line number Diff line number Diff line change 1+ using RealTimeWeatherMonitoringApp . Application . Interfaces ;
2+ using RealTimeWeatherMonitoringApp . Domain . Common ;
3+
4+ namespace RealTimeWeatherMonitoringApp . Application . Service ;
5+
6+ public class MonitoringService < TData > : IDataReceiver < TData > , IDataChangeNotifier < TData >
7+ {
8+ public void Receive ( TData data ) =>
9+ OnDataChange ? . Invoke ( this , new DataChangeEventArgs < TData > ( data ) ) ;
10+
11+ public event EventHandler < DataChangeEventArgs < TData > > ? OnDataChange ;
12+ }
You can’t perform that action at this time.
0 commit comments