From 8b9bb3698aae7558aa3393df255372e94d4502d7 Mon Sep 17 00:00:00 2001 From: BOT Alex <44818698+MagicBOTAlex@users.noreply.github.com> Date: Fri, 14 Jul 2023 09:27:40 +0800 Subject: [PATCH] Added easy mode checkbox --- CCharLearn/Pages/Index.razor | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/CCharLearn/Pages/Index.razor b/CCharLearn/Pages/Index.razor index 25b7ac6..9c7ce04 100644 --- a/CCharLearn/Pages/Index.razor +++ b/CCharLearn/Pages/Index.razor @@ -14,7 +14,7 @@ } - + @((!continueDataExists) ? "Start learning!" : "Start new!") @if (continueDataExists) @@ -35,6 +35,10 @@ + + + + @if (Charecters != null) { @@ -86,6 +90,19 @@ bool continueDataExists = false; int continueCharectersLeft = -1; + private bool isEasyMode; + + public bool IsEasyMode + { + get { return isEasyMode; } + set + { + isEasyMode = value; + SetEasyMode(); + } + } + + protected async override Task OnInitializedAsync() { @@ -134,6 +151,11 @@ StateHasChanged(); } + async void SetEasyMode() + { + await localStorage.SetItemAsync("EasyMode", isEasyMode); + } + async Task LoadAllChunksIntoLocalStorage() { isLoading = true; @@ -190,5 +212,10 @@ { continueCharectersLeft = await localStorage.GetItemAsync("ContinueCharectersLeft"); } + + if (await localStorage.ContainKeyAsync("EasyMode")) + { + isEasyMode = await localStorage.GetItemAsync("EasyMode"); + } } } \ No newline at end of file