public static async ValueTask <EffectiveParams> CreateByGettingUserSettings(IJSRuntime jsRuntime, DailyData dailyData, int debugLevel = 0) { var settings = (await UserSettings.GetSettings(jsRuntime, dailyData.InfectDataCount, dailyData)).Cleanup(); return(new EffectiveParams(dailyData, settings, debugLevel).RenewDecaySubParams()); }
/// <summary> /// 保存しておいた設定を取得する /// </summary> /// <returns></returns> public static async ValueTask <UserSettings> GetSettings(IJSRuntime jsRuntime, int numData, DailyData dailyData) { try { return(await getLocalStorage(jsRuntime, numData)); } catch (Exception e) { if (e is MyException) { logger.Warn($"settings read failed: {e.Message}"); } else { logger.Error($"settings read failed.\n{e}"); } logger.Info($"Use initial settings instead."); return((new UserSettings().SetJsRuntime(jsRuntime)).Initialize(numData)); } }
public EffectiveParams(DailyData dailyData, UserSettings settings, int debugLevel = 0) { _dailyData = dailyData; DebugLevel = debugLevel >= 0 ? debugLevel : ConsoleLog.DEBUG_LEVEL; CurrentSettings = settings ?? UserSettings.CreateInitialSettings(); }