mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
UI - Use PropertyChanged.SourceGenerator everywhere else
This commit is contained in:
1 parent
d656c6960d
commit
190d797f1a
40 files changed
+223
-934
No files matched your search
@@ -8,13 +8,14 @@ using Artemis.UI.Screens.Debugger.Render;
|
||||
using Artemis.UI.Screens.Debugger.Routing;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Artemis.UI.Shared;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger;
|
||||
|
||||
public class DebugViewModel : ActivatableViewModelBase, IScreen
|
||||
public partial class DebugViewModel : ActivatableViewModelBase, IScreen
|
||||
{
|
||||
private ViewModelBase _selectedItem;
|
||||
[Notify] private ViewModelBase _selectedItem;
|
||||
|
||||
public DebugViewModel(IDebugService debugService, RenderDebugViewModel render, DataModelDebugViewModel dataModel, PerformanceDebugViewModel performance, RoutingDebugViewModel routing, LogsDebugViewModel logs)
|
||||
{
|
||||
@@ -25,13 +26,7 @@ public class DebugViewModel : ActivatableViewModelBase, IScreen
|
||||
}
|
||||
|
||||
public ObservableCollection<ViewModelBase> Items { get; }
|
||||
|
||||
public ViewModelBase SelectedItem
|
||||
{
|
||||
get => _selectedItem;
|
||||
set => RaiseAndSetIfChanged(ref _selectedItem, value);
|
||||
}
|
||||
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
OnActivationRequested();
|
||||
|
||||
@@ -12,21 +12,21 @@ using Artemis.UI.Shared.DataModelVisualization.Shared;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Avalonia.Threading;
|
||||
using DynamicData;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.DataModel;
|
||||
|
||||
public class DataModelDebugViewModel : ActivatableViewModelBase
|
||||
public partial class DataModelDebugViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly IDataModelUIService _dataModelUIService;
|
||||
private readonly IPluginManagementService _pluginManagementService;
|
||||
private readonly DispatcherTimer _updateTimer;
|
||||
|
||||
private bool _isModuleFilterEnabled;
|
||||
private DataModelPropertiesViewModel? _mainDataModel;
|
||||
private string? _propertySearch;
|
||||
private Module? _selectedModule;
|
||||
private bool _slowUpdates;
|
||||
[Notify] private DataModelPropertiesViewModel? _mainDataModel;
|
||||
[Notify] private string? _propertySearch;
|
||||
|
||||
public DataModelDebugViewModel(IDataModelUIService dataModelUIService, IPluginManagementService pluginManagementService)
|
||||
{
|
||||
@@ -57,18 +57,6 @@ public class DataModelDebugViewModel : ActivatableViewModelBase
|
||||
});
|
||||
}
|
||||
|
||||
public DataModelPropertiesViewModel? MainDataModel
|
||||
{
|
||||
get => _mainDataModel;
|
||||
set => RaiseAndSetIfChanged(ref _mainDataModel, value);
|
||||
}
|
||||
|
||||
public string? PropertySearch
|
||||
{
|
||||
get => _propertySearch;
|
||||
set => RaiseAndSetIfChanged(ref _propertySearch, value);
|
||||
}
|
||||
|
||||
public bool SlowUpdates
|
||||
{
|
||||
get => _slowUpdates;
|
||||
|
||||
+8
-43
@@ -1,16 +1,17 @@
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Shared;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.Performance;
|
||||
|
||||
public class PerformanceDebugMeasurementViewModel : ViewModelBase
|
||||
public partial class PerformanceDebugMeasurementViewModel : ViewModelBase
|
||||
{
|
||||
private string? _average;
|
||||
private string? _last;
|
||||
private string? _max;
|
||||
private string? _min;
|
||||
private string? _percentile;
|
||||
private string? _count;
|
||||
[Notify] private string? _average;
|
||||
[Notify] private string? _last;
|
||||
[Notify] private string? _max;
|
||||
[Notify] private string? _min;
|
||||
[Notify] private string? _percentile;
|
||||
[Notify] private string? _count;
|
||||
|
||||
public PerformanceDebugMeasurementViewModel(ProfilingMeasurement measurement)
|
||||
{
|
||||
@@ -19,42 +20,6 @@ public class PerformanceDebugMeasurementViewModel : ViewModelBase
|
||||
|
||||
public ProfilingMeasurement Measurement { get; }
|
||||
|
||||
public string? Last
|
||||
{
|
||||
get => _last;
|
||||
set => RaiseAndSetIfChanged(ref _last, value);
|
||||
}
|
||||
|
||||
public string? Average
|
||||
{
|
||||
get => _average;
|
||||
set => RaiseAndSetIfChanged(ref _average, value);
|
||||
}
|
||||
|
||||
public string? Min
|
||||
{
|
||||
get => _min;
|
||||
set => RaiseAndSetIfChanged(ref _min, value);
|
||||
}
|
||||
|
||||
public string? Max
|
||||
{
|
||||
get => _max;
|
||||
set => RaiseAndSetIfChanged(ref _max, value);
|
||||
}
|
||||
|
||||
public string? Percentile
|
||||
{
|
||||
get => _percentile;
|
||||
set => RaiseAndSetIfChanged(ref _percentile, value);
|
||||
}
|
||||
|
||||
public string? Count
|
||||
{
|
||||
get => _count;
|
||||
set => RaiseAndSetIfChanged(ref _count, value);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
Last = Measurement.GetLast().TotalMilliseconds + " ms";
|
||||
|
||||
@@ -7,20 +7,21 @@ using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared;
|
||||
using Avalonia.Threading;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.Performance;
|
||||
|
||||
public class PerformanceDebugViewModel : ActivatableViewModelBase
|
||||
public partial class PerformanceDebugViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly IRenderService _renderService;
|
||||
private readonly IPluginManagementService _pluginManagementService;
|
||||
private readonly DispatcherTimer _updateTimer;
|
||||
private double _currentFps;
|
||||
private string? _renderer;
|
||||
private int _renderHeight;
|
||||
private int _renderWidth;
|
||||
[Notify] private double _currentFps;
|
||||
[Notify] private string? _renderer;
|
||||
[Notify] private int _renderHeight;
|
||||
[Notify] private int _renderWidth;
|
||||
|
||||
public PerformanceDebugViewModel(IRenderService renderService, IPluginManagementService pluginManagementService)
|
||||
{
|
||||
@@ -59,31 +60,7 @@ public class PerformanceDebugViewModel : ActivatableViewModelBase
|
||||
}
|
||||
|
||||
public ObservableCollection<PerformanceDebugPluginViewModel> Items { get; } = new();
|
||||
|
||||
public double CurrentFps
|
||||
{
|
||||
get => _currentFps;
|
||||
set => RaiseAndSetIfChanged(ref _currentFps, value);
|
||||
}
|
||||
|
||||
public int RenderWidth
|
||||
{
|
||||
get => _renderWidth;
|
||||
set => RaiseAndSetIfChanged(ref _renderWidth, value);
|
||||
}
|
||||
|
||||
public int RenderHeight
|
||||
{
|
||||
get => _renderHeight;
|
||||
set => RaiseAndSetIfChanged(ref _renderHeight, value);
|
||||
}
|
||||
|
||||
public string? Renderer
|
||||
{
|
||||
get => _renderer;
|
||||
set => RaiseAndSetIfChanged(ref _renderer, value);
|
||||
}
|
||||
|
||||
|
||||
private void HandleActivation()
|
||||
{
|
||||
Renderer = Constants.ManagedGraphicsContext != null ? Constants.ManagedGraphicsContext.GetType().Name : "Software";
|
||||
|
||||
@@ -4,21 +4,21 @@ using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared;
|
||||
using Avalonia.Media.Imaging;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.Render;
|
||||
|
||||
public class RenderDebugViewModel : ActivatableViewModelBase
|
||||
public partial class RenderDebugViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly IRenderService _renderService;
|
||||
private double _currentFps;
|
||||
|
||||
private Bitmap? _currentFrame;
|
||||
private string? _frameTargetPath;
|
||||
private string? _renderer;
|
||||
private int _renderHeight;
|
||||
private int _renderWidth;
|
||||
[Notify] private double _currentFps;
|
||||
[Notify] private Bitmap? _currentFrame;
|
||||
[Notify] private string? _renderer;
|
||||
[Notify] private int _renderHeight;
|
||||
[Notify] private int _renderWidth;
|
||||
|
||||
public RenderDebugViewModel(IRenderService renderService)
|
||||
{
|
||||
@@ -33,36 +33,6 @@ public class RenderDebugViewModel : ActivatableViewModelBase
|
||||
});
|
||||
}
|
||||
|
||||
public Bitmap? CurrentFrame
|
||||
{
|
||||
get => _currentFrame;
|
||||
set => RaiseAndSetIfChanged(ref _currentFrame, value);
|
||||
}
|
||||
|
||||
public double CurrentFps
|
||||
{
|
||||
get => _currentFps;
|
||||
set => RaiseAndSetIfChanged(ref _currentFps, value);
|
||||
}
|
||||
|
||||
public int RenderWidth
|
||||
{
|
||||
get => _renderWidth;
|
||||
set => RaiseAndSetIfChanged(ref _renderWidth, value);
|
||||
}
|
||||
|
||||
public int RenderHeight
|
||||
{
|
||||
get => _renderHeight;
|
||||
set => RaiseAndSetIfChanged(ref _renderHeight, value);
|
||||
}
|
||||
|
||||
public string? Renderer
|
||||
{
|
||||
get => _renderer;
|
||||
set => RaiseAndSetIfChanged(ref _renderer, value);
|
||||
}
|
||||
|
||||
private void HandleActivation()
|
||||
{
|
||||
Renderer = Constants.ManagedGraphicsContext != null ? Constants.ManagedGraphicsContext.GetType().Name : "Software";
|
||||
|
||||
@@ -11,18 +11,19 @@ using Artemis.UI.Shared.Routing;
|
||||
using Avalonia.Controls.Documents;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Threading;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using Serilog.Events;
|
||||
using Serilog.Formatting.Display;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.Routing;
|
||||
|
||||
public class RoutingDebugViewModel : ActivatableViewModelBase
|
||||
public partial class RoutingDebugViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly IRouter _router;
|
||||
private const int MAX_ENTRIES = 1000;
|
||||
private readonly MessageTemplateTextFormatter _formatter;
|
||||
private string? _route;
|
||||
[Notify] private string? _route;
|
||||
|
||||
public RoutingDebugViewModel(IRouter router)
|
||||
{
|
||||
@@ -49,12 +50,6 @@ public class RoutingDebugViewModel : ActivatableViewModelBase
|
||||
public InlineCollection Lines { get; } = new();
|
||||
public ReactiveCommand<Unit, Unit> Navigate { get; }
|
||||
|
||||
public string? Route
|
||||
{
|
||||
get => _route;
|
||||
set => RaiseAndSetIfChanged(ref _route, value);
|
||||
}
|
||||
|
||||
private void OnLogEventAdded(object? sender, LogEventEventArgs e)
|
||||
{
|
||||
Dispatcher.UIThread.Post(() => AddLogEvent(e.LogEvent));
|
||||
|
||||
Reference in new issue
Block a user