1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Debugger - Replaced NavigationView in favor for something simpler

This commit is contained in:
Robert 2022-08-07 16:19:41 +02:00
parent faf5302975
commit 87e87ae15d
35 changed files with 452 additions and 3293 deletions

View File

@ -1,18 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Artemis.Core\Artemis.Core.csproj" />
</ItemGroup>
</Project>

View File

@ -1,40 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Artemis.Core;
using BenchmarkDotNet.Attributes;
namespace Artemis.Benchmarking
{
public class NumericConversion
{
private readonly float _float;
private readonly Numeric _numeric;
public NumericConversion()
{
_float = 255235235f;
_numeric = new Numeric(_float);
}
[Benchmark]
public void FloatToIntCast()
{
var integer = (int) _float;
}
[Benchmark]
public void NumericToIntCast()
{
var integer = (int) _numeric;
}
[Benchmark]
public void NumericToIntConvertTo()
{
var integer = Convert.ChangeType(_numeric, typeof(int));
}
}
}

View File

@ -1,3 +0,0 @@
using BenchmarkDotNet.Running;
BenchmarkRunner.Run(typeof(Program).Assembly);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1668,10 +1668,7 @@
"Unosquare.Swan.Lite": {
"type": "Transitive",
"resolved": "3.0.0",
"contentHash": "noPwJJl1Q9uparXy1ogtkmyAPGNfSGb0BLT1292nFH1jdMKje6o2kvvrQUvF9Xklj+IoiAI0UzF6Aqxlvo10lw==",
"dependencies": {
"System.ValueTuple": "4.5.0"
}
"contentHash": "noPwJJl1Q9uparXy1ogtkmyAPGNfSGb0BLT1292nFH1jdMKje6o2kvvrQUvF9Xklj+IoiAI0UzF6Aqxlvo10lw=="
},
"artemis.core": {
"type": "Project",

View File

@ -1668,10 +1668,7 @@
"Unosquare.Swan.Lite": {
"type": "Transitive",
"resolved": "3.0.0",
"contentHash": "noPwJJl1Q9uparXy1ogtkmyAPGNfSGb0BLT1292nFH1jdMKje6o2kvvrQUvF9Xklj+IoiAI0UzF6Aqxlvo10lw==",
"dependencies": {
"System.ValueTuple": "4.5.0"
}
"contentHash": "noPwJJl1Q9uparXy1ogtkmyAPGNfSGb0BLT1292nFH1jdMKje6o2kvvrQUvF9Xklj+IoiAI0UzF6Aqxlvo10lw=="
},
"artemis.core": {
"type": "Project",

View File

@ -1,4 +1,5 @@
using System;
using System.Text.RegularExpressions;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Layout;
@ -17,6 +18,7 @@ namespace Artemis.UI.Shared
/// </summary>
public class ArtemisIcon : UserControl
{
private static Regex _imageRegex = new(@"[\/.](gif|jpg|jpeg|tiff|png)$", RegexOptions.Compiled);
/// <summary>
/// Creates a new instance of the <see cref="ArtemisIcon" /> class.
/// </summary>
@ -39,9 +41,7 @@ namespace Artemis.UI.Shared
{
// First look for an enum value instead of a string
if (Icon is MaterialIconKind materialIcon)
{
Content = new MaterialIcon {Kind = materialIcon, Width = Bounds.Width, Height = Bounds.Height};
}
// If it's a string there are several options
else if (Icon is string iconString)
{
@ -49,7 +49,7 @@ namespace Artemis.UI.Shared
if (Enum.TryParse(iconString, true, out MaterialIconKind parsedIcon))
Content = new MaterialIcon {Kind = parsedIcon, Width = Bounds.Width, Height = Bounds.Height};
// An URI pointing to an image
else
else if (_imageRegex.IsMatch(iconString))
{
if (!Fill)
{
@ -71,6 +71,8 @@ namespace Artemis.UI.Shared
};
}
}
else
Content = new MaterialIcon {Kind = MaterialIconKind.QuestionMark, Width = Bounds.Width, Height = Bounds.Height};
}
}
catch

View File

@ -5,8 +5,11 @@
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:reactiveUi="http://reactiveui.net"
xmlns:debugger="clr-namespace:Artemis.UI.Screens.Debugger"
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="800"
x:Class="Artemis.UI.Screens.Debugger.DebugView"
x:DataType="debugger:DebugViewModel"
Icon="/Assets/Images/Logo/application.ico"
Title="Artemis | Debugger"
Width="1200"
@ -21,55 +24,18 @@
</Style>
</Window.Styles>
<Panel>
<controls:NavigationView x:Name="Navigation"
SelectedItem="{Binding SelectedItem}"
IsPaneToggleButtonVisible="False"
PaneDisplayMode="Left"
Margin="0 10 0 0">
<controls:NavigationView.MenuItems>
<controls:NavigationViewItem Tag="Rendering">
<controls:NavigationViewItem.Content>
<StackPanel Orientation="Horizontal" Classes="sidebar-stackpanel">
<avalonia:MaterialIcon Kind="Paint" />
<TextBlock>Rendering</TextBlock>
</StackPanel>
</controls:NavigationViewItem.Content>
</controls:NavigationViewItem>
<controls:NavigationViewItem Tag="DataModel">
<controls:NavigationViewItem.Content>
<StackPanel Orientation="Horizontal" Classes="sidebar-stackpanel">
<avalonia:MaterialIcon Kind="FormatListBulletedType" />
<TextBlock>Data Model</TextBlock>
</StackPanel>
</controls:NavigationViewItem.Content>
</controls:NavigationViewItem>
<controls:NavigationViewItem Tag="Performance">
<controls:NavigationViewItem.Content>
<StackPanel Orientation="Horizontal" Classes="sidebar-stackpanel">
<avalonia:MaterialIcon Kind="Gauge" />
<TextBlock>Performance</TextBlock>
</StackPanel>
</controls:NavigationViewItem.Content>
</controls:NavigationViewItem>
<controls:NavigationViewItem Tag="Logging">
<controls:NavigationViewItem.Content>
<StackPanel Orientation="Horizontal" Classes="sidebar-stackpanel">
<avalonia:MaterialIcon Kind="Text" />
<TextBlock>Logging</TextBlock>
</StackPanel>
</controls:NavigationViewItem.Content>
</controls:NavigationViewItem>
</controls:NavigationView.MenuItems>
<reactiveUi:RoutedViewHost Router="{Binding Router}" Padding="12">
<reactiveUi:RoutedViewHost.PageTransition>
<CrossFade Duration="0.1" />
</reactiveUi:RoutedViewHost.PageTransition>
</reactiveUi:RoutedViewHost>
</controls:NavigationView>
<StackPanel Classes="notification-container" Name="NotificationContainer" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
</Panel>
<Grid ColumnDefinitions="240,*">
<ListBox Items="{CompiledBinding Items}" SelectedItem="{CompiledBinding SelectedItem}" Grid.Column="0" Margin="10">
<ListBox.ItemTemplate>
<DataTemplate x:DataType="shared:ViewModelBase">
<TextBlock Text="{CompiledBinding DisplayName}" VerticalAlignment="Center" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Border Classes="router-container" Grid.Column="1">
<ContentControl Content="{CompiledBinding SelectedItem}" Margin="15"></ContentControl>
</Border>
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Classes="notification-container" Name="NotificationContainer" VerticalAlignment="Bottom" HorizontalAlignment="Right" />
</Grid>
</controls:CoreWindow>

View File

@ -22,17 +22,13 @@ namespace Artemis.UI.Screens.Debugger
this.AttachDevTools();
#endif
NavigationView navigation = this.Get<NavigationView>("Navigation");
this.WhenActivated(d =>
{
Observable.FromEventPattern(x => ViewModel!.ActivationRequested += x, x => ViewModel!.ActivationRequested -= x).Subscribe(_ =>
{
WindowState = WindowState.Normal;
Activate();
}).DisposeWith(d);
ViewModel!.SelectedItem = (NavigationViewItem) navigation.MenuItems.ElementAt(0);
});
}

View File

@ -1,77 +1,40 @@
using System;
using System.Collections.ObjectModel;
using System.Reactive.Disposables;
using Artemis.UI.Screens.Debugger.DataModel;
using Artemis.UI.Screens.Debugger.Logs;
using Artemis.UI.Screens.Debugger.Performance;
using Artemis.UI.Screens.Debugger.Render;
using Artemis.UI.Screens.Debugger.Settings;
using Artemis.UI.Services.Interfaces;
using Artemis.UI.Shared;
using FluentAvalonia.UI.Controls;
using Ninject;
using Ninject.Parameters;
using ReactiveUI;
namespace Artemis.UI.Screens.Debugger
namespace Artemis.UI.Screens.Debugger;
public class DebugViewModel : ActivatableViewModelBase, IScreen
{
public class DebugViewModel : ActivatableViewModelBase, IScreen
{
private readonly IKernel _kernel;
private readonly IDebugService _debugService;
private NavigationViewItem? _selectedItem;
private ViewModelBase _selectedItem;
public DebugViewModel(IKernel kernel, IDebugService debugService)
public DebugViewModel(IDebugService debugService,
RenderDebugViewModel render,
DataModelDebugViewModel dataModel,
PerformanceDebugViewModel performance,
LogsDebugViewModel logs)
{
_kernel = kernel;
_debugService = debugService;
Items = new ObservableCollection<ViewModelBase> {render, dataModel, performance, logs};
SelectedItem = render;
this.WhenAnyValue(x => x.SelectedItem).WhereNotNull().Subscribe(NavigateToSelectedItem);
this.WhenActivated(disposables =>
{
Disposable
.Create(HandleDeactivation)
.DisposeWith(disposables);
});
this.WhenActivated(d => Disposable.Create(debugService.ClearDebugger).DisposeWith(d));
}
public ObservableCollection<ViewModelBase> Items { get; }
public NavigationViewItem? SelectedItem
public ViewModelBase SelectedItem
{
get => _selectedItem;
set => RaiseAndSetIfChanged(ref _selectedItem, value);
}
private void NavigateToSelectedItem(NavigationViewItem item)
{
// Kind of a lame way to do this but it's so static idc
ConstructorArgument hostScreen = new("hostScreen", this);
switch (item.Tag as string)
{
case "Rendering":
Router.Navigate.Execute(_kernel.Get<RenderDebugViewModel>(hostScreen));
break;
case "DataModel":
Router.Navigate.Execute(_kernel.Get<DataModelDebugViewModel>(hostScreen));
break;
case "Performance":
Router.Navigate.Execute(_kernel.Get<PerformanceDebugViewModel>(hostScreen));
break;
case "Logging":
Router.Navigate.Execute(_kernel.Get<LogsDebugViewModel>(hostScreen));
break;
case "Settings":
Router.Navigate.Execute(_kernel.Get<DebugSettingsViewModel>(hostScreen));
break;
}
}
private void HandleDeactivation()
{
_debugService.ClearDebugger();
}
public RoutingState Router { get; } = new();
public void Activate()
{
OnActivationRequested();
@ -83,5 +46,6 @@ namespace Artemis.UI.Screens.Debugger
{
ActivationRequested?.Invoke(this, EventArgs.Empty);
}
}
public RoutingState Router { get; } = new();
}

View File

@ -1,10 +1,10 @@
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
namespace Artemis.UI.Screens.Debugger.DataModel
namespace Artemis.UI.Screens.Debugger.DataModel;
public class DataModelDebugView : ReactiveUserControl<DataModelDebugViewModel>
{
public class DataModelDebugView : ReactiveUserControl<DataModelDebugViewModel>
{
public DataModelDebugView()
{
InitializeComponent();
@ -14,5 +14,4 @@ namespace Artemis.UI.Screens.Debugger.DataModel
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -16,7 +16,7 @@ using ReactiveUI;
namespace Artemis.UI.Screens.Debugger.DataModel;
public class DataModelDebugViewModel : ActivatableViewModelBase, IRoutableViewModel
public class DataModelDebugViewModel : ActivatableViewModelBase
{
private readonly IDataModelUIService _dataModelUIService;
private readonly IPluginManagementService _pluginManagementService;
@ -28,13 +28,13 @@ public class DataModelDebugViewModel : ActivatableViewModelBase, IRoutableViewMo
private Module? _selectedModule;
private bool _slowUpdates;
public DataModelDebugViewModel(IScreen hostScreen, IDataModelUIService dataModelUIService, IPluginManagementService pluginManagementService)
public DataModelDebugViewModel(IDataModelUIService dataModelUIService, IPluginManagementService pluginManagementService)
{
_dataModelUIService = dataModelUIService;
_pluginManagementService = pluginManagementService;
_updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(25), DispatcherPriority.DataBind, (_, _) => Update());
_updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(40), DispatcherPriority.Background, (_, _) => Update());
HostScreen = hostScreen;
DisplayName = "Data Model";
Modules = new ObservableCollection<Module>();
this.WhenActivated(disposables =>
@ -142,7 +142,4 @@ public class DataModelDebugViewModel : ActivatableViewModelBase, IRoutableViewMo
SelectedModule = null;
}
}
public string UrlPathSegment => "data-model";
public IScreen HostScreen { get; }
}

View File

@ -1,10 +1,10 @@
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
namespace Artemis.UI.Screens.Debugger.Logs
namespace Artemis.UI.Screens.Debugger.Logs;
public class LogsDebugView : ReactiveUserControl<LogsDebugViewModel>
{
public class LogsDebugView : ReactiveUserControl<LogsDebugViewModel>
{
public LogsDebugView()
{
InitializeComponent();
@ -14,5 +14,4 @@ namespace Artemis.UI.Screens.Debugger.Logs
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -1,16 +1,11 @@
using Artemis.UI.Shared;
using ReactiveUI;
namespace Artemis.UI.Screens.Debugger.Logs
namespace Artemis.UI.Screens.Debugger.Logs;
public class LogsDebugViewModel : ActivatableViewModelBase
{
public class LogsDebugViewModel : ActivatableViewModelBase, IRoutableViewModel
public LogsDebugViewModel()
{
public LogsDebugViewModel(IScreen hostScreen)
{
HostScreen = hostScreen;
}
public string UrlPathSegment => "logs";
public IScreen HostScreen { get; }
DisplayName = "Logs";
}
}

View File

@ -1,11 +1,10 @@
using Artemis.Core;
using Artemis.UI.Shared;
using ReactiveUI;
namespace Artemis.UI.Screens.Debugger.Performance
namespace Artemis.UI.Screens.Debugger.Performance;
public class PerformanceDebugMeasurementViewModel : ViewModelBase
{
public class PerformanceDebugMeasurementViewModel : ViewModelBase
{
private string? _average;
private string? _last;
private string? _max;
@ -57,5 +56,4 @@ namespace Artemis.UI.Screens.Debugger.Performance
Max = Measurement.GetMax().TotalMilliseconds + " ms";
Percentile = Measurement.GetPercentile(0.95).TotalMilliseconds + " ms";
}
}
}

View File

@ -12,7 +12,7 @@
<TextBlock Grid.Column="1" VerticalAlignment="Center" Classes="h5" Text="{Binding Plugin.Info.Name}" />
</Grid>
<ItemsControl Items="{Binding Profilers}"/>
<ItemsControl Items="{Binding Profilers}" />
</StackPanel>
</Border>
</UserControl>

View File

@ -1,10 +1,10 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Artemis.UI.Screens.Debugger.Performance
namespace Artemis.UI.Screens.Debugger.Performance;
public class PerformanceDebugPluginView : UserControl
{
public partial class PerformanceDebugPluginView : UserControl
{
public PerformanceDebugPluginView()
{
InitializeComponent();
@ -14,5 +14,4 @@ namespace Artemis.UI.Screens.Debugger.Performance
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -3,10 +3,10 @@ using System.Linq;
using Artemis.Core;
using Artemis.UI.Shared;
namespace Artemis.UI.Screens.Debugger.Performance
namespace Artemis.UI.Screens.Debugger.Performance;
public class PerformanceDebugPluginViewModel : ViewModelBase
{
public class PerformanceDebugPluginViewModel : ViewModelBase
{
public PerformanceDebugPluginViewModel(Plugin plugin)
{
Plugin = plugin;
@ -27,5 +27,4 @@ namespace Artemis.UI.Screens.Debugger.Performance
foreach (PerformanceDebugProfilerViewModel profilerViewModel in Profilers)
profilerViewModel.Update();
}
}
}

View File

@ -1,10 +1,10 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Artemis.UI.Screens.Debugger.Performance
namespace Artemis.UI.Screens.Debugger.Performance;
public class PerformanceDebugProfilerView : UserControl
{
public partial class PerformanceDebugProfilerView : UserControl
{
public PerformanceDebugProfilerView()
{
InitializeComponent();
@ -14,5 +14,4 @@ namespace Artemis.UI.Screens.Debugger.Performance
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -3,10 +3,10 @@ using System.Linq;
using Artemis.Core;
using Artemis.UI.Shared;
namespace Artemis.UI.Screens.Debugger.Performance
namespace Artemis.UI.Screens.Debugger.Performance;
public class PerformanceDebugProfilerViewModel : ViewModelBase
{
public class PerformanceDebugProfilerViewModel : ViewModelBase
{
public PerformanceDebugProfilerViewModel(Profiler profiler)
{
Profiler = profiler;
@ -27,5 +27,4 @@ namespace Artemis.UI.Screens.Debugger.Performance
foreach (PerformanceDebugMeasurementViewModel profilingMeasurementViewModel in Measurements)
profilingMeasurementViewModel.Update();
}
}
}

View File

@ -28,8 +28,8 @@
<TextBlock Text="{Binding RenderWidth}" />
<TextBlock Text="x" />
<TextBlock Text="{Binding RenderHeight}" />
<TextBlock Text=" - Renderer: "></TextBlock>
<TextBlock Text="{Binding Renderer}"></TextBlock>
<TextBlock Text=" - Renderer: " />
<TextBlock Text="{Binding Renderer}" />
</StackPanel>

View File

@ -1,10 +1,10 @@
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
namespace Artemis.UI.Screens.Debugger.Performance
namespace Artemis.UI.Screens.Debugger.Performance;
public class PerformanceDebugView : ReactiveUserControl<PerformanceDebugViewModel>
{
public class PerformanceDebugView : ReactiveUserControl<PerformanceDebugViewModel>
{
public PerformanceDebugView()
{
InitializeComponent();
@ -14,5 +14,4 @@ namespace Artemis.UI.Screens.Debugger.Performance
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -12,7 +12,7 @@ using SkiaSharp;
namespace Artemis.UI.Screens.Debugger.Performance;
public class PerformanceDebugViewModel : ActivatableViewModelBase, IRoutableViewModel
public class PerformanceDebugViewModel : ActivatableViewModelBase
{
private readonly ICoreService _coreService;
private readonly IPluginManagementService _pluginManagementService;
@ -22,13 +22,14 @@ public class PerformanceDebugViewModel : ActivatableViewModelBase, IRoutableView
private int _renderHeight;
private int _renderWidth;
public PerformanceDebugViewModel(IScreen hostScreen, ICoreService coreService, IPluginManagementService pluginManagementService)
public PerformanceDebugViewModel(ICoreService coreService, IPluginManagementService pluginManagementService)
{
HostScreen = hostScreen;
_coreService = coreService;
_pluginManagementService = pluginManagementService;
_updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(500), DispatcherPriority.Normal, (_, _) => Update());
DisplayName = "Performance";
this.WhenActivated(disposables =>
{
Observable.FromEventPattern<PluginFeatureEventArgs>(x => pluginManagementService.PluginFeatureEnabled += x, x => pluginManagementService.PluginFeatureEnabled -= x)
@ -123,8 +124,4 @@ public class PerformanceDebugViewModel : ActivatableViewModelBase, IRoutableView
RenderHeight = bitmapInfo.Height;
RenderWidth = bitmapInfo.Width;
}
public string UrlPathSegment => "performance";
public IScreen HostScreen { get; }
}

View File

@ -20,8 +20,8 @@
<TextBlock Text="{Binding RenderWidth}" />
<TextBlock Text="x" />
<TextBlock Text="{Binding RenderHeight}" />
<TextBlock Text=" - Renderer: "></TextBlock>
<TextBlock Text="{Binding Renderer}"></TextBlock>
<TextBlock Text=" - Renderer: " />
<TextBlock Text="{Binding Renderer}" />
</StackPanel>
<Border Classes="card" Padding="10">
@ -34,7 +34,7 @@
<Image Name="Visualization" Source="{Binding CurrentFrame}">
<Image.Transitions>
<Transitions>
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.2" Easing="CubicEaseOut"/>
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.2" Easing="CubicEaseOut" />
</Transitions>
</Image.Transitions>
</Image>

View File

@ -1,10 +1,10 @@
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
namespace Artemis.UI.Screens.Debugger.Render
namespace Artemis.UI.Screens.Debugger.Render;
public class RenderDebugView : ReactiveUserControl<RenderDebugViewModel>
{
public class RenderDebugView : ReactiveUserControl<RenderDebugViewModel>
{
public RenderDebugView()
{
InitializeComponent();
@ -14,5 +14,4 @@ namespace Artemis.UI.Screens.Debugger.Render
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -7,10 +7,10 @@ using Avalonia.Media.Imaging;
using ReactiveUI;
using SkiaSharp;
namespace Artemis.UI.Screens.Debugger.Render
namespace Artemis.UI.Screens.Debugger.Render;
public class RenderDebugViewModel : ActivatableViewModelBase
{
public class RenderDebugViewModel : ActivatableViewModelBase, IRoutableViewModel
{
private readonly ICoreService _coreService;
private double _currentFps;
@ -20,11 +20,12 @@ namespace Artemis.UI.Screens.Debugger.Render
private int _renderHeight;
private int _renderWidth;
public RenderDebugViewModel(DebugViewModel hostScreen, ICoreService coreService)
public RenderDebugViewModel(ICoreService coreService)
{
HostScreen = hostScreen;
_coreService = coreService;
DisplayName = "Rendering";
this.WhenActivated(disposables =>
{
HandleActivation();
@ -101,8 +102,4 @@ namespace Artemis.UI.Screens.Debugger.Render
CurrentFrame = new Bitmap(data.AsStream());
}
}
public string UrlPathSegment => "render";
public IScreen HostScreen { get; }
}
}

View File

@ -1,10 +1,10 @@
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
namespace Artemis.UI.Screens.Debugger.Settings
namespace Artemis.UI.Screens.Debugger.Settings;
public class DebugSettingsView : ReactiveUserControl<DebugSettingsViewModel>
{
public class DebugSettingsView : ReactiveUserControl<DebugSettingsViewModel>
{
public DebugSettingsView()
{
InitializeComponent();
@ -14,5 +14,4 @@ namespace Artemis.UI.Screens.Debugger.Settings
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -1,16 +1,11 @@
using Artemis.UI.Shared;
using ReactiveUI;
namespace Artemis.UI.Screens.Debugger.Settings
namespace Artemis.UI.Screens.Debugger.Settings;
public class DebugSettingsViewModel : ActivatableViewModelBase
{
public class DebugSettingsViewModel : ActivatableViewModelBase, IRoutableViewModel
public DebugSettingsViewModel()
{
public DebugSettingsViewModel(IScreen hostScreen)
{
HostScreen = hostScreen;
}
public string UrlPathSegment => "logs";
public IScreen HostScreen { get; }
DisplayName = "Settings";
}
}

View File

@ -17,22 +17,18 @@
<TextBox Classes="clearButton" Text="{CompiledBinding SearchPluginInput}" Watermark="Search plugins" Margin="0 0 10 0" />
<StackPanel Spacing="5" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
<controls:HyperlinkButton Grid.Row="0"
Grid.Column="1"
VerticalAlignment="Top"
NavigateUri="https://wiki.artemis-rgb.com/en/guides/user/plugins">
<controls:HyperlinkButton VerticalAlignment="Top" NavigateUri="https://wiki.artemis-rgb.com/en/guides/user/plugins">
Get more plugins
</controls:HyperlinkButton>
<Button Classes="accent" Command="{CompiledBinding ImportPlugin}">Import plugin</Button>
</StackPanel>
</Grid>
<ScrollViewer Grid.Row="1" Grid.Column="0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" VerticalAlignment="Top">
<ItemsRepeater Items="{CompiledBinding Plugins}" MaxWidth="900" VerticalAlignment="Center">
<ItemsRepeater.ItemTemplate>
<DataTemplate x:DataType="plugins:PluginSettingsViewModel">
<ContentControl Content="{CompiledBinding}"/>
<ContentControl Content="{CompiledBinding}" Height="200"/>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>

View File

@ -36,12 +36,13 @@ namespace Artemis.UI.Screens.Settings
DisplayName = "Plugins";
SourceList<Plugin> plugins = new();
IObservable<Func<Plugin, bool>> pluginFilter = this.WhenAnyValue(vm => vm.SearchPluginInput).Throttle(TimeSpan.FromMilliseconds(100), AvaloniaScheduler.Instance).Select(CreatePredicate);
IObservable<Func<Plugin, bool>> pluginFilter = this.WhenAnyValue(vm => vm.SearchPluginInput).Throttle(TimeSpan.FromMilliseconds(100)).Select(CreatePredicate);
plugins.Connect()
.Filter(pluginFilter)
.Sort(SortExpressionComparer<Plugin>.Ascending(p => p.Info.Name))
.Transform(settingsVmFactory.PluginSettingsViewModel)
.ObserveOn(AvaloniaScheduler.Instance)
.Bind(out ReadOnlyObservableCollection<PluginSettingsViewModel> pluginViewModels)
.Subscribe();
Plugins = pluginViewModels;

View File

@ -47,36 +47,42 @@ Global
{035CBB38-7B9E-4375-A39C-E9A5B01F23A5}.Release|Any CPU.ActiveCfg = Release|x64
{035CBB38-7B9E-4375-A39C-E9A5B01F23A5}.Release|x64.ActiveCfg = Release|x64
{035CBB38-7B9E-4375-A39C-E9A5B01F23A5}.Debug|Any CPU.Build.0 = Debug|x64
{035CBB38-7B9E-4375-A39C-E9A5B01F23A5}.Release|x64.Build.0 = Release|x64
{05A5AB0F-A303-4404-9623-4DB1C9AA1DA0}.Debug|Any CPU.ActiveCfg = Debug|x64
{05A5AB0F-A303-4404-9623-4DB1C9AA1DA0}.Debug|x64.ActiveCfg = Debug|x64
{05A5AB0F-A303-4404-9623-4DB1C9AA1DA0}.Debug|x64.Build.0 = Debug|x64
{05A5AB0F-A303-4404-9623-4DB1C9AA1DA0}.Release|Any CPU.ActiveCfg = Release|x64
{05A5AB0F-A303-4404-9623-4DB1C9AA1DA0}.Release|x64.ActiveCfg = Release|x64
{05A5AB0F-A303-4404-9623-4DB1C9AA1DA0}.Debug|Any CPU.Build.0 = Debug|x64
{05A5AB0F-A303-4404-9623-4DB1C9AA1DA0}.Release|x64.Build.0 = Release|x64
{DE45A288-9320-461F-BE2A-26DFE3817216}.Debug|Any CPU.ActiveCfg = Debug|x64
{DE45A288-9320-461F-BE2A-26DFE3817216}.Debug|x64.ActiveCfg = Debug|x64
{DE45A288-9320-461F-BE2A-26DFE3817216}.Debug|x64.Build.0 = Debug|x64
{DE45A288-9320-461F-BE2A-26DFE3817216}.Release|Any CPU.ActiveCfg = Release|x64
{DE45A288-9320-461F-BE2A-26DFE3817216}.Release|x64.ActiveCfg = Release|x64
{DE45A288-9320-461F-BE2A-26DFE3817216}.Debug|Any CPU.Build.0 = Debug|x64
{DE45A288-9320-461F-BE2A-26DFE3817216}.Release|x64.Build.0 = Release|x64
{9012C8E2-3BEC-42F5-8270-7352A5922B04}.Debug|Any CPU.ActiveCfg = Debug|x64
{9012C8E2-3BEC-42F5-8270-7352A5922B04}.Debug|x64.ActiveCfg = Debug|x64
{9012C8E2-3BEC-42F5-8270-7352A5922B04}.Debug|x64.Build.0 = Debug|x64
{9012C8E2-3BEC-42F5-8270-7352A5922B04}.Release|Any CPU.ActiveCfg = Release|x64
{9012C8E2-3BEC-42F5-8270-7352A5922B04}.Release|x64.ActiveCfg = Release|x64
{9012C8E2-3BEC-42F5-8270-7352A5922B04}.Debug|Any CPU.Build.0 = Debug|x64
{9012C8E2-3BEC-42F5-8270-7352A5922B04}.Release|x64.Build.0 = Release|x64
{2F5F16DC-FACF-4559-9882-37C2949814C7}.Debug|Any CPU.ActiveCfg = Debug|x64
{2F5F16DC-FACF-4559-9882-37C2949814C7}.Debug|x64.ActiveCfg = Debug|x64
{2F5F16DC-FACF-4559-9882-37C2949814C7}.Debug|x64.Build.0 = Debug|x64
{2F5F16DC-FACF-4559-9882-37C2949814C7}.Release|Any CPU.ActiveCfg = Release|x64
{2F5F16DC-FACF-4559-9882-37C2949814C7}.Release|x64.ActiveCfg = Release|x64
{2F5F16DC-FACF-4559-9882-37C2949814C7}.Debug|Any CPU.Build.0 = Debug|x64
{2F5F16DC-FACF-4559-9882-37C2949814C7}.Release|x64.Build.0 = Release|x64
{412B921A-26F5-4AE6-8B32-0C19BE54F421}.Debug|Any CPU.ActiveCfg = Debug|x64
{412B921A-26F5-4AE6-8B32-0C19BE54F421}.Debug|x64.ActiveCfg = Debug|x64
{412B921A-26F5-4AE6-8B32-0C19BE54F421}.Debug|x64.Build.0 = Debug|x64
{412B921A-26F5-4AE6-8B32-0C19BE54F421}.Release|Any CPU.ActiveCfg = Release|x64
{412B921A-26F5-4AE6-8B32-0C19BE54F421}.Release|x64.ActiveCfg = Release|x64
{412B921A-26F5-4AE6-8B32-0C19BE54F421}.Debug|Any CPU.Build.0 = Debug|x64
{412B921A-26F5-4AE6-8B32-0C19BE54F421}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE