wanshenmean
2026-03-13 a2b55742c64f4b2c9e6bd85ed3733adccdec48de
Code/WCS/WIDESEAWCS_S7Simulator/WIDESEAWCS_S7Simulator.Web/Pages/Details.cshtml.cs
@@ -10,13 +10,12 @@
public class DetailsModel : PageModel
{
    private readonly ILogger<DetailsModel> _logger;
    private readonly HttpClient _httpClient;
    private readonly IHttpClientFactory _httpClientFactory;
    public DetailsModel(ILogger<DetailsModel> logger, IHttpClientFactory httpClientFactory)
    {
        _logger = logger;
        _httpClient = httpClientFactory.CreateClient();
        _httpClient.BaseAddress = new Uri($"{Request.Scheme}://{Request.Host}");
        _httpClientFactory = httpClientFactory;
    }
    public InstanceState? Instance { get; private set; }
@@ -32,14 +31,17 @@
        try
        {
            var response = await _httpClient.GetAsync($"/api/SimulatorInstances/{Uri.EscapeDataString(id)}");
            var httpClient = _httpClientFactory.CreateClient();
            httpClient.BaseAddress = new Uri($"{Request.Scheme}://{Request.Host}");
            var response = await httpClient.GetAsync($"/api/SimulatorInstances/{Uri.EscapeDataString(id)}");
            if (response.IsSuccessStatusCode)
            {
                Instance = await response.Content.ReadFromJsonAsync<InstanceState>();
                // Load clients
                var clientsResponse = await _httpClient.GetAsync($"/api/instances/{Uri.EscapeDataString(id)}/Clients");
                var clientsResponse = await httpClient.GetAsync($"/api/instances/{Uri.EscapeDataString(id)}/Clients");
                if (clientsResponse.IsSuccessStatusCode)
                {
                    Clients = await clientsResponse.Content.ReadFromJsonAsync<List<S7ClientConnection>>() ?? new();