Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
51 lines (46 loc) · 1.82 KB
/
Copy pathProgram.cs
File metadata and controls
51 lines (46 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using ConcertScannerAppWASM.Data;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using MudBlazor.Services;
namespace ConcertScannerAppWASM
{
public class Program
{
private static string PromptText(string label, bool hidden)
{
Console.Write(label + ":");
var input = string.Empty;
ConsoleKey key;
do
{
var keyInfo = Console.ReadKey(true);
key = keyInfo.Key;
if (key == ConsoleKey.Backspace && input.Length > 0)
{
Console.Write("\b \b");
input = input[0..^1];
}
else if (!char.IsControl(keyInfo.KeyChar))
{
Console.Write(hidden ? "*" : keyInfo.KeyChar);
input += keyInfo.KeyChar;
}
} while (key != ConsoleKey.Enter);
Console.WriteLine();
return input;
}
public static async Task Main(string[] args)
{
Environment.SetEnvironmentVariable("server", PromptText("IP/Host", false));
Environment.SetEnvironmentVariable("user", PromptText("Username", false));
Environment.SetEnvironmentVariable("password", PromptText("Password", true));
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddSingleton<DataService>();
builder.Services.AddMudServices();
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
await builder.Build().RunAsync();
}
}
}