77 lines
1.8 KiB
C#
77 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Components;
|
|
using System.Net.Http;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
|
using Microsoft.AspNetCore.Components.Forms;
|
|
using Microsoft.AspNetCore.Components.Routing;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
|
using Microsoft.JSInterop;
|
|
using MP.INVE;
|
|
using MP.INVE.Shared;
|
|
using MP.INVE.Components;
|
|
using MP.INVE.Data;
|
|
using StackExchange.Redis;
|
|
using NLog.Targets;
|
|
|
|
namespace MP.INVE.Components
|
|
{
|
|
public partial class CodeScan
|
|
{
|
|
// FIXME TODO creare evento x riportare scansione
|
|
[Parameter]
|
|
public EventCallback<string> lastRawScan { get; set; }
|
|
|
|
|
|
private ElementReference target;
|
|
private ElementReference target2;
|
|
|
|
|
|
protected string _lastScan = "";
|
|
protected string css = "";
|
|
protected string LastScan
|
|
{
|
|
get => _lastScan;
|
|
set
|
|
{
|
|
_lastScan = value.Trim();
|
|
if (value != "")
|
|
{
|
|
saveSel(LastScan);
|
|
}
|
|
target2.FocusAsync();
|
|
css = "disabilita";
|
|
}
|
|
}
|
|
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
if (firstRender)
|
|
{
|
|
await target.FocusAsync();
|
|
}
|
|
}
|
|
|
|
|
|
private void saveSel(string scanToSend)
|
|
{
|
|
if (scanToSend != "")
|
|
{
|
|
Task.FromResult(lastRawScan.InvokeAsync(scanToSend));
|
|
}
|
|
LastScan = "";
|
|
}
|
|
|
|
private async void newScan()
|
|
{
|
|
css = "";
|
|
await target.FocusAsync();
|
|
}
|
|
}
|
|
|
|
} |