Browse Source

Add SharedState singleton observable

pull/55/head
Ionite 1 year ago
parent
commit
c188a1d394
No known key found for this signature in database
  1. 4
      StabilityMatrix.Avalonia/DesignData/DesignData.cs
  2. 14
      StabilityMatrix.Avalonia/Models/SharedState.cs

4
StabilityMatrix.Avalonia/DesignData/DesignData.cs

@ -5,6 +5,7 @@ using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Net.Http;
using Microsoft.Extensions.DependencyInjection;
using StabilityMatrix.Avalonia.Models;
using StabilityMatrix.Avalonia.Services;
using StabilityMatrix.Avalonia.ViewModels;
using StabilityMatrix.Avalonia.ViewModels.Dialogs;
@ -62,7 +63,8 @@ public static class DesignData
services.AddLogging()
.AddSingleton<IPackageFactory, PackageFactory>()
.AddSingleton<IUpdateHelper, UpdateHelper>()
.AddSingleton<ModelFinder>();
.AddSingleton<ModelFinder>()
.AddSingleton<SharedState>();
// Mock services
services

14
StabilityMatrix.Avalonia/Models/SharedState.cs

@ -0,0 +1,14 @@
using CommunityToolkit.Mvvm.ComponentModel;
namespace StabilityMatrix.Avalonia.Models;
/// <summary>
/// Singleton DI service for observable shared UI state.
/// </summary>
public partial class SharedState : ObservableObject
{
/// <summary>
/// Whether debug mode enabled from settings page version tap.
/// </summary>
[ObservableProperty] private bool isDebugMode;
}
Loading…
Cancel
Save