Files
ThreadPilot/ViewModels/DiagnosticsViewModelProvider.cs
T
Prime Build 266834cbdf Reduce Performance tab to optional diagnostics (#17)
Reduce Performance tab to optional diagnostics

Hide the Performance/Diagnostics surface from the primary UX by default and remove hidden startup/tray runtime cost.

- Hide Diagnostics from primary navigation and tray by default
- Lazy-create PerformanceViewModel only when Diagnostics is opened
- Stop initializing diagnostics snapshots during app startup
- Gate tray CPU/RAM metrics behind the advanced diagnostics flag
- Avoid starting the tray lightweight metrics timer when diagnostics are hidden
- Lazily allocate PerformanceMonitoringService counters on first metrics use
- Stop live diagnostics when inactive, minimized or tray-hidden
- Preserve diagnostics internals for future selected-process summary work
- Add tests for lazy diagnostics creation, tray metrics gating and explicit diagnostics activation

No Process tab redesign, CPU affinity changes, memory priority changes, persistent rules changes, version bump or tag changes.
2026-05-21 23:47:21 +02:00

42 lines
1.5 KiB
C#

/*
* ThreadPilot - Advanced Windows Process and Power Plan Manager
* Copyright (C) 2025 Prime Build
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, version 3 only.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace ThreadPilot.ViewModels
{
using System;
public interface IDiagnosticsViewModelProvider
{
bool IsCreated { get; }
PerformanceViewModel GetOrCreate();
}
public sealed class DiagnosticsViewModelProvider : IDiagnosticsViewModelProvider
{
private readonly Lazy<PerformanceViewModel> performanceViewModel;
public DiagnosticsViewModelProvider(Lazy<PerformanceViewModel> performanceViewModel)
{
this.performanceViewModel = performanceViewModel ?? throw new ArgumentNullException(nameof(performanceViewModel));
}
public bool IsCreated => this.performanceViewModel.IsValueCreated;
public PerformanceViewModel GetOrCreate() => this.performanceViewModel.Value;
}
}