feature(BuildCalc) Added reset button, can change micro delay, and can alter timing interval again
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
checked="@Value
|
||||
"@onchange="OnChange"/>
|
||||
</div>
|
||||
@if (Info != "") {
|
||||
@if (Info != "")
|
||||
{
|
||||
<div class="formInfo">
|
||||
@Info
|
||||
</div>
|
||||
@@ -66,7 +67,8 @@
|
||||
|
||||
private string labelId = "";
|
||||
|
||||
protected override void OnInitialized() {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
labelId = Label.ToLower().Replace(" ", "_");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<div class="displayContainer">
|
||||
@if (Label != "") {
|
||||
@if (Label != "")
|
||||
{
|
||||
<div class="formLabel">
|
||||
@Label
|
||||
</div>
|
||||
@@ -7,7 +8,8 @@
|
||||
<div class="displayContent">
|
||||
@Display
|
||||
</div>
|
||||
@if (Info != "") {
|
||||
@if (Info != "")
|
||||
{
|
||||
<div class="formInfo">
|
||||
@Info
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
@code {
|
||||
string Output = "";
|
||||
|
||||
public void OnChange(ChangeEventArgs changeEventArgs) {
|
||||
public void OnChange(ChangeEventArgs changeEventArgs)
|
||||
{
|
||||
var encoded = HttpUtility.HtmlEncode(changeEventArgs.Value!.ToString());
|
||||
Output = encoded?.Replace("@", "@@")!;
|
||||
Output = Output.Replace("\n", "<br />");
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
@using Services
|
||||
@using Model.MemoryTester
|
||||
@using Services.Immortal
|
||||
@using Model.MemoryTester
|
||||
@implements IDisposable
|
||||
|
||||
@inject IMemoryTesterService MemoryTesterService
|
||||
|
||||
<div class="formGuessContainer">
|
||||
@if (MemoryQuestion.Name != "") {
|
||||
@if (MemoryQuestion.Name != "")
|
||||
{
|
||||
<div class="formLabel">
|
||||
@MemoryQuestion.Name
|
||||
</div>
|
||||
@@ -94,46 +94,57 @@
|
||||
|
||||
private string labelId = "";
|
||||
|
||||
protected override void OnInitialized() {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
labelId = Label.ToLower().Replace(" ", "_") + MemoryQuestion.Id;
|
||||
|
||||
MemoryTesterService.Subscribe(OnMemoryEvent);
|
||||
|
||||
if (MemoryQuestion.IsRevealed) {
|
||||
if (MemoryQuestion.IsRevealed)
|
||||
{
|
||||
guess = MemoryQuestion.Answer.ToString();
|
||||
}
|
||||
|
||||
OnRefresh();
|
||||
}
|
||||
|
||||
void IDisposable.Dispose() {
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
MemoryTesterService.Unsubscribe(OnMemoryEvent);
|
||||
}
|
||||
|
||||
void OnMemoryEvent(MemoryTesterEvent memoryTesterEvent) {
|
||||
if (memoryTesterEvent == MemoryTesterEvent.OnVerify) {
|
||||
void OnMemoryEvent(MemoryTesterEvent memoryTesterEvent)
|
||||
{
|
||||
if (memoryTesterEvent == MemoryTesterEvent.OnVerify)
|
||||
{
|
||||
OnVerify();
|
||||
}
|
||||
|
||||
if (memoryTesterEvent == MemoryTesterEvent.OnRefresh) {
|
||||
if (memoryTesterEvent == MemoryTesterEvent.OnRefresh)
|
||||
{
|
||||
OnRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAfterRender(bool firstRender) {
|
||||
if (MemoryQuestion.IsRevealed) {
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (MemoryQuestion.IsRevealed)
|
||||
{
|
||||
guess = MemoryQuestion.Answer.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
void OnVerify() {
|
||||
void OnVerify()
|
||||
{
|
||||
IsSubmitted = true;
|
||||
}
|
||||
|
||||
void OnRefresh() {
|
||||
void OnRefresh()
|
||||
{
|
||||
guess = "";
|
||||
|
||||
if (MemoryQuestion.IsRevealed) {
|
||||
if (MemoryQuestion.IsRevealed)
|
||||
{
|
||||
guess = MemoryQuestion.Answer.ToString();
|
||||
}
|
||||
|
||||
@@ -141,10 +152,12 @@
|
||||
IsSubmitted = false;
|
||||
}
|
||||
|
||||
void OnGuessChanged(ChangeEventArgs changeEventArgs) {
|
||||
void OnGuessChanged(ChangeEventArgs changeEventArgs)
|
||||
{
|
||||
guess = changeEventArgs.Value!.ToString()!;
|
||||
|
||||
OnChange.InvokeAsync(new AnswerEventArgs {
|
||||
OnChange.InvokeAsync(new AnswerEventArgs
|
||||
{
|
||||
Name = MemoryQuestion.Name,
|
||||
IsCorrect = int.Parse(guess) == MemoryQuestion.Answer,
|
||||
Guess = int.Parse(guess)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<div class="formNumberContainer">
|
||||
@if (FormLabelComponent != null) {
|
||||
@if (FormLabelComponent != null)
|
||||
{
|
||||
<FormLabelComponent>@FormLabelComponent</FormLabelComponent>
|
||||
}
|
||||
<div>
|
||||
@@ -11,7 +12,8 @@
|
||||
value="@Value"
|
||||
@onchange="OnChange"/>
|
||||
</div>
|
||||
@if (FormInfoComponent != null) {
|
||||
@if (FormInfoComponent != null)
|
||||
{
|
||||
<FormInfoComponent>@FormInfoComponent</FormInfoComponent>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<div style="display: flex; width: 100%; flex-direction: column; gap:6px;">
|
||||
@if (FormLabelComponent != null) {
|
||||
@if (FormLabelComponent != null)
|
||||
{
|
||||
<FormLabelComponent>@FormLabelComponent</FormLabelComponent>
|
||||
}
|
||||
<select style="background-color: #2C2E33; width: 100%; border:3px solid #A8ADB9; border-radius:1px; padding: 8px;"
|
||||
@@ -7,7 +8,8 @@
|
||||
@ChildContent
|
||||
</select>
|
||||
|
||||
@if (FormInfoComponent != null) {
|
||||
@if (FormInfoComponent != null)
|
||||
{
|
||||
<FormInfoComponent>@FormInfoComponent</FormInfoComponent>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<div class="form-text-container">
|
||||
@if (Label != "") {
|
||||
@if (Label != "")
|
||||
{
|
||||
<div class="form-label">
|
||||
@Label
|
||||
</div>
|
||||
@@ -12,7 +13,8 @@
|
||||
value="@Value"
|
||||
@onchange="OnChange" />
|
||||
</div>
|
||||
@if (Info != "") {
|
||||
@if (Info != "")
|
||||
{
|
||||
<div class="form-info">
|
||||
@Info
|
||||
</div>
|
||||
@@ -83,7 +85,8 @@
|
||||
|
||||
private string labelId = "";
|
||||
|
||||
protected override void OnInitialized() {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
labelId = Label.ToLower().Replace(" ", "_");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<div class="formContainer">
|
||||
@if (Label != "") {
|
||||
@if (Label != "")
|
||||
{
|
||||
<div class="formLabel">
|
||||
@Label
|
||||
</div>
|
||||
@@ -13,7 +14,8 @@
|
||||
id="@labelId"
|
||||
@onchange="OnChange"/>
|
||||
</div>
|
||||
@if (Info != "") {
|
||||
@if (Info != "")
|
||||
{
|
||||
<div class="formInfo">
|
||||
@Info
|
||||
</div>
|
||||
@@ -68,7 +70,8 @@
|
||||
|
||||
private string labelId = "";
|
||||
|
||||
protected override void OnInitialized() {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
labelId = Label.ToLower().Replace(" ", "_");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user