mirror of
http://git.xinwangdao.com/cnnc-embedded-parts-detect/detect.git
synced 2025-06-25 05:54:14 +08:00
35 lines
917 B
C#
35 lines
917 B
C#
using System;
|
|
using ReactiveUI;
|
|
using Serilog;
|
|
using xwd.utils;
|
|
|
|
namespace detect.gui.ViewModels;
|
|
|
|
public class WebViewModel : ViewModelBase
|
|
{
|
|
private readonly string[] _localRoutes =
|
|
[
|
|
"#/dashboard",
|
|
"#/data/task",
|
|
"#/data/device",
|
|
"#/system/log",
|
|
"#/system/user"
|
|
];
|
|
|
|
private string? _address;
|
|
|
|
public string? Address
|
|
{
|
|
get => _address;
|
|
set => this.RaiseAndSetIfChanged(ref _address, value);
|
|
}
|
|
|
|
public void SetAddress(int index)
|
|
{
|
|
var isOnLine = AppSettingsManager.Manager().GetBool("Embedded.IsOnline");
|
|
var path = AppSettingsManager.Manager().GetString("Embedded.Path", "./dist/index.html");
|
|
var prefix = isOnLine ? path : AppDomain.CurrentDomain.BaseDirectory + path;
|
|
Address = $"{prefix}{_localRoutes[index]}";
|
|
Log.Information("current address: {address}", Address);
|
|
}
|
|
} |