Files
JMR-devandCopilot 594429bb7d Add fully-injected MainWindowViewModel constructor
Introduce an injected constructor taking IHardwareMonitorService, ILogger,
IRemoteWebServer (+ the concrete selection/plot/startup services) and
IStartupTracer, with shared settings initialization. A transitional 2-arg
constructor still builds the legacy graph for MainWindow until it is
DI-resolved; an _ownsServices flag keeps disposal correct across both paths.

Break the VM<->RemoteWebServer construction cycle by moving the root provider
to RemoteWebServer.SetRootProvider (removing it from the constructor), and make
RemoteWebServer.Quit idempotent. Update RemoteWebServer tests for the new ctor.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-02 15:09:12 -05:00

37 lines
998 B
C#

// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Copyright (C) LibreHardwareMonitor and Contributors.
using System;
namespace LibreHardwareMonitor.Windows.WinUI.Services;
/// <summary>
/// Optional HTTP server exposing sensor data. Extracted as an interface so the view model can be
/// unit-tested with a fake (and so the real server's network resources stay out of tests).
/// </summary>
public interface IRemoteWebServer : IDisposable
{
bool AuthEnabled { get; set; }
string ListenerIp { get; set; }
int ListenerPort { get; set; }
string PasswordHash { get; }
bool PlatformNotSupported { get; }
string UserName { get; set; }
void SetRootProvider(Func<ViewModels.SensorTreeItemViewModel?> rootProvider);
void SetPassword(string plainPassword);
bool Start();
bool Stop();
void Quit();
}