private void DownloadSettings() { var report = new Report(SettingsEndAddress - SettingsStartAddress); // Download settings from 0000h-0100h for (var a = SettingsStartAddress; a <= SettingsEndAddress; a += DataReadLength) { DownloadBlock(a, d => { report.AddRawData(d); return true; }); } // Create data object from report Settings = report.GetObject<Settings>(); OnSettingsLoaded(this, Settings); }
static void WeatherStationSettingsLoaded(IWeatherStation weatherStation, Settings stationReport) { Console.WriteLine(JsonConvert.SerializeObject(stationReport)); }
protected virtual void OnSettingsLoaded(IWeatherStation weatherStation, Settings settings) { var handler = SettingsLoaded; if (handler != null) handler(weatherStation, settings); }