Core - Remove API versioning, we have MinimumVersion to achieve the same thing

This commit is contained in:
Robert committed 2025-12-19 23:11:27 +01:00
1 parent e2cb73e327
commit 86f2426f37
184 files changed
+598 -523

No files matched your search

@@ -47,7 +47,7 @@ public class DataModelPicker : TemplatedControl
/// A list of extra modules to show data models of.
/// </summary>
public static readonly StyledProperty<ObservableCollection<Module>?> ModulesProperty =
AvaloniaProperty.Register<DataModelPicker, ObservableCollection<Module>?>(nameof(Modules), new ObservableCollection<Module>());
AvaloniaProperty.Register<DataModelPicker, ObservableCollection<Module>?>(nameof(Modules), []);
/// <summary>
/// The data model view model to show, if not provided one will be retrieved by the control.
@@ -59,7 +59,7 @@ public class DataModelPicker : TemplatedControl
/// A list of types to filter the selectable paths on.
/// </summary>
public static readonly StyledProperty<ObservableCollection<Type>?> FilterTypesProperty =
AvaloniaProperty.Register<DataModelPicker, ObservableCollection<Type>?>(nameof(FilterTypes), new ObservableCollection<Type>());
AvaloniaProperty.Register<DataModelPicker, ObservableCollection<Type>?>(nameof(FilterTypes), []);
/// <summary>
/// Gets or sets a boolean indicating whether the picker is in event picker mode.
@@ -222,7 +222,7 @@ public class DataModelPicker : TemplatedControl
if (DataModelUIService == null)
return;
ChangeDataModel(DataModelUIService.GetPluginDataModelVisualization(Modules?.ToList() ?? new List<Module>(), true));
ChangeDataModel(DataModelUIService.GetPluginDataModelVisualization(Modules?.ToList() ?? [], true));
}
private void ChangeDataModel(DataModelPropertiesViewModel? dataModel)
@@ -65,13 +65,13 @@ public class DataModelPickerButton : TemplatedControl
/// A list of extra modules to show data models of.
/// </summary>
public static readonly StyledProperty<ObservableCollection<Module>?> ModulesProperty =
AvaloniaProperty.Register<DataModelPicker, ObservableCollection<Module>?>(nameof(Modules), new ObservableCollection<Module>());
AvaloniaProperty.Register<DataModelPicker, ObservableCollection<Module>?>(nameof(Modules), []);
/// <summary>
/// A list of types to filter the selectable paths on.
/// </summary>
public static readonly StyledProperty<ObservableCollection<Type>?> FilterTypesProperty =
AvaloniaProperty.Register<DataModelPicker, ObservableCollection<Type>?>(nameof(FilterTypes), new ObservableCollection<Type>());
AvaloniaProperty.Register<DataModelPicker, ObservableCollection<Type>?>(nameof(FilterTypes), []);
/// <summary>
/// Gets or sets a boolean indicating whether the picker is in event picker mode.
@@ -34,13 +34,13 @@ public class DeviceVisualizer : Control
private RenderTargetBitmap? _deviceImage;
private ArtemisDevice? _oldDevice;
private bool _loading;
private Color[] _previousState = Array.Empty<Color>();
private Color[] _previousState = [];
/// <inheritdoc />
public DeviceVisualizer()
{
_renderService = UI.Locator.Resolve<IRenderService>();
_deviceVisualizerLeds = new List<DeviceVisualizerLed>();
_deviceVisualizerLeds = [];
PointerReleased += OnPointerReleased;
PropertyChanged += OnPropertyChanged;
@@ -105,11 +105,11 @@ internal class DeviceVisualizerLed
Geometry geometry = Geometry.Parse(Led.RgbLed.ShapeData);
geometry.Transform = new TransformGroup
{
Children = new Transforms
{
Children =
[
new ScaleTransform(width, height),
new TranslateTransform(Led.RgbLed.Location.X + deflateAmount / 2, Led.RgbLed.Location.Y + deflateAmount / 2)
}
]
};
DisplayGeometry = geometry;
}
@@ -19,7 +19,7 @@ public partial class EnumComboBox : UserControl
/// </summary>
public static readonly StyledProperty<object?> ValueProperty = AvaloniaProperty.Register<EnumComboBox, object?>(nameof(Value), defaultBindingMode: BindingMode.TwoWay);
private readonly ObservableCollection<EnumComboBoxItem> _currentValues = new();
private readonly ObservableCollection<EnumComboBoxItem> _currentValues = [];
private Type? _currentType;
/// <summary>
@@ -269,7 +269,7 @@ public class GradientPicker : TemplatedControl
private void UpdateGradient()
{
// Update the display gradient
GradientStops collection = new();
GradientStops collection = [];
foreach (ColorGradientStop c in EditingColorGradient.OrderBy(s => s.Position))
collection.Add(new GradientStop(Color.FromArgb(c.Color.Alpha, c.Color.Red, c.Color.Green, c.Color.Blue), c.Position));
@@ -169,7 +169,7 @@ public class GradientPickerButton : TemplatedControl
private void UpdateGradient()
{
// Update the display gradient
GradientStops collection = new();
GradientStops collection = [];
if (ColorGradient != null)
foreach (ColorGradientStop c in ColorGradient.OrderBy(s => s.Position))
collection.Add(new GradientStop(Color.FromArgb(c.Color.Alpha, c.Color.Red, c.Color.Green, c.Color.Blue), c.Position));
@@ -10,7 +10,7 @@ public partial class TagsInput : TemplatedControl
/// Defines the <see cref="Tags" /> property
/// </summary>
public static readonly StyledProperty<ObservableCollection<string>> TagsProperty =
AvaloniaProperty.Register<TagsInput, ObservableCollection<string>>(nameof(Tags), new ObservableCollection<string>());
AvaloniaProperty.Register<TagsInput, ObservableCollection<string>>(nameof(Tags), []);
/// <summary>
/// Gets or sets the selected tags.
@@ -17,7 +17,7 @@ public class ColorGradientToGradientStopsConverter : IValueConverter
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
ColorGradient? colorGradient = value as ColorGradient;
GradientStops collection = new();
GradientStops collection = [];
if (colorGradient == null)
return collection;
@@ -30,7 +30,7 @@ public class ColorGradientToGradientStopsConverter : IValueConverter
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
GradientStops? collection = value as GradientStops;
ColorGradient colorGradients = new();
ColorGradient colorGradients = [];
if (collection == null)
return colorGradients;
@@ -24,7 +24,7 @@ public class DataModelListViewModel : DataModelVisualizationViewModel
: base(dataModel, parent, dataModelPath)
{
_countDisplay = "0 items";
_listChildren = new ObservableCollection<DataModelVisualizationViewModel>();
_listChildren = [];
}
/// <summary>
@@ -29,7 +29,7 @@ public abstract class DataModelVisualizationViewModel : ReactiveObject, IDisposa
internal DataModelVisualizationViewModel(DataModel? dataModel, DataModelVisualizationViewModel? parent, DataModelPath? dataModelPath)
{
_dataModel = dataModel;
_children = new ObservableCollection<DataModelVisualizationViewModel>();
_children = [];
_parent = parent;
DataModelPath = dataModelPath;
IsMatchingFilteredTypes = true;
@@ -18,7 +18,7 @@ public static class ContainerExtensions
{
container.Register<IRouter, Router>(Reuse.Singleton);
Assembly artemisShared = typeof(IArtemisSharedUIService).GetAssembly();
container.RegisterMany(new[] {artemisShared}, type => type.IsAssignableTo<IArtemisSharedUIService>(), Reuse.Singleton);
container.RegisterMany([artemisShared], type => type.IsAssignableTo<IArtemisSharedUIService>(), Reuse.Singleton);
UI.Locator = container;
}
@@ -125,11 +125,11 @@ public static class ArtemisLayoutExtensions
Geometry geometry = Geometry.Parse(led.RgbLayout.ShapeData);
geometry.Transform = new TransformGroup
{
Children = new Transforms
{
Children =
[
new ScaleTransform(width, height),
new TranslateTransform(led.RgbLayout.X + deflateAmount / 2, led.RgbLayout.Y + deflateAmount / 2)
}
]
};
return geometry;
}
@@ -18,7 +18,7 @@ public static class VisualExtensions
/// <returns>A recursive list of all visual children of type <typeparamref name="T" />.</returns>
public static List<T> GetVisualChildrenOfType<T>(this Visual root)
{
List<T> result = new();
List<T> result = [];
List<Visual>? visualChildren = root.GetVisualChildren()?.ToList();
if (visualChildren == null || !visualChildren.Any())
@@ -43,7 +43,7 @@ public static class VisualExtensions
/// <returns>A recursive list of all visual children with a data context of type <typeparamref name="T" />.</returns>
public static List<T> GetVisualChildrenOfDataContextType<T>(this Visual root)
{
List<T> result = new();
List<T> result = [];
List<Visual>? visualChildren = root.GetVisualChildren()?.ToList();
if (visualChildren == null || !visualChildren.Any())
+1 -1
View File
@@ -49,7 +49,7 @@ public class ReactiveAppWindow<TViewModel> : AppWindow, IViewFor<TViewModel> whe
return;
// TransparencyBackgroundFallback = Brushes.Transparent;
TransparencyLevelHint = new[] {WindowTransparencyLevel.Mica};
TransparencyLevelHint = [WindowTransparencyLevel.Mica];
Background = new SolidColorBrush(new Color(80, 0,0,0));
}
@@ -88,7 +88,7 @@ public abstract class RoutableScreen<TParam> : RoutableScreen, IRoutableScreen w
Expression<Func<object[], TParam>> lambda = Expression.Lambda<Func<object[], TParam>>(
Expression.Block(
new[] {parameterExpression},
[parameterExpression],
Expression.Assign(parameterExpression, Expression.New(parameterType)),
Expression.Block(propertyAssignments),
parameterExpression
@@ -44,5 +44,5 @@ public class RouteRegistration<TViewModel> : IRouterRegistration where TViewMode
public Type ViewModel => typeof(TViewModel);
/// <inheritdoc />
public List<IRouterRegistration> Children { get; set; } = new();
public List<IRouterRegistration> Children { get; set; } = [];
}
@@ -25,7 +25,7 @@ internal class RouteResolution
return AsFailure(path);
// Ensure self is a match
List<object> parameters = new();
List<object> parameters = [];
int currentSegment = 0;
foreach (RouteSegment routeSegment in registration.Route.Segments)
{
@@ -95,7 +95,7 @@ internal class RouteResolution
public object[] GetAllParameters()
{
List<object> result = new();
List<object> result = [];
if (Parameters != null)
result.AddRange(Parameters);
object[]? childParameters = Child?.GetAllParameters();
@@ -86,7 +86,7 @@ internal class Navigation
return;
// Navigate on the screen
args.SegmentParameters = resolution.Parameters ?? Array.Empty<object>();
args.SegmentParameters = resolution.Parameters ?? [];
try
{
await screen.InternalOnNavigating(args, _cts.Token);
@@ -13,7 +13,7 @@ public class NavigationArguments
Options = options;
Path = path;
RouteParameters = routeParameters;
SegmentParameters = Array.Empty<object>();
SegmentParameters = [];
}
/// <summary>
@@ -68,7 +68,7 @@ internal class Router : CorePropertyChanged, IRouter, IDisposable
public IObservable<string?> CurrentPath => _currentRouteSubject;
/// <inheritdoc />
public List<IRouterRegistration> Routes { get; } = new();
public List<IRouterRegistration> Routes { get; } = [];
/// <inheritdoc />
public async Task Navigate(string path, RouterNavigationOptions? options = null)
@@ -11,7 +11,7 @@ namespace Artemis.UI.Shared.Services.Builders;
public class FileDialogFilterBuilder
{
private string _name;
private readonly List<string> _extensions = new();
private readonly List<string> _extensions = [];
internal FileDialogFilterBuilder()
{
@@ -61,7 +61,7 @@ public class OpenFileDialogBuilder
FileDialogFilterBuilder builder = new();
configure(builder);
_fileTypeFilters ??= new List<FilePickerFileType>();
_fileTypeFilters ??= [];
_fileTypeFilters.Add(builder.Build());
_options.FileTypeFilter = _fileTypeFilters;
@@ -60,7 +60,7 @@ public class SaveFileDialogBuilder
FileDialogFilterBuilder builder = new();
configure(builder);
_fileTypeFilters ??= new List<FilePickerFileType>();
_fileTypeFilters ??= [];
_fileTypeFilters.Add(builder.Build());
_options.FileTypeChoices = _fileTypeFilters;
@@ -25,8 +25,8 @@ internal class DataModelUIService : IDataModelUIService
{
_dataModelService = dataModelService;
_container = container;
_registeredDataModelEditors = new List<DataModelVisualizationRegistration>();
_registeredDataModelDisplays = new List<DataModelVisualizationRegistration>();
_registeredDataModelEditors = [];
_registeredDataModelDisplays = [];
RegisteredDataModelEditors = new ReadOnlyCollection<DataModelVisualizationRegistration>(_registeredDataModelEditors);
RegisteredDataModelDisplays = new ReadOnlyCollection<DataModelVisualizationRegistration>(_registeredDataModelDisplays);
@@ -34,9 +34,9 @@ public class NodeConnectionStore
// Iterate to save
foreach (IPin nodePin in Node.Pins.ToList())
_pinConnections.Add(nodePin, new List<IPin>(nodePin.ConnectedTo));
_pinConnections.Add(nodePin, [..nodePin.ConnectedTo]);
foreach (IPin nodePin in Node.PinCollections.ToList().SelectMany(nodePinCollection => nodePinCollection))
_pinConnections.Add(nodePin, new List<IPin>(nodePin.ConnectedTo));
_pinConnections.Add(nodePin, [..nodePin.ConnectedTo]);
// Iterate to disconnect
foreach (IPin nodePin in Node.Pins.ToList())
@@ -20,7 +20,7 @@ public class NodeEditorCommandScope : IDisposable
Name = name;
_nodeEditorService = nodeEditorService;
_nodeScript = nodeScript;
_commands = new List<INodeEditorCommand>();
_commands = [];
}
/// <summary>
@@ -17,7 +17,7 @@ public class ProfileEditorCommandScope : IDisposable
{
Name = name;
_profileEditorService = profileEditorService;
_commands = new List<IProfileEditorCommand>();
_commands = [];
}
/// <summary>
@@ -15,7 +15,7 @@ internal class PropertyInputService : IPropertyInputService
public PropertyInputService(IContainer container)
{
_container = container;
_registeredPropertyEditors = new List<PropertyInputRegistration>();
_registeredPropertyEditors = [];
RegisteredPropertyEditors = new ReadOnlyCollection<PropertyInputRegistration>(_registeredPropertyEditors);
}
@@ -113,6 +113,6 @@ internal class PropertyInputService : IPropertyInputService
// ReSharper disable once InconsistentlySynchronizedField
// When you've just spent the last 2 hours trying to figure out a deadlock and reach this line, I'm so, so sorry. I thought this would be fine.
IContainer container = registration?.Plugin.Container ?? _container;
return (PropertyInputViewModel<T>) container.Resolve(viewModelType, args: new object[] { layerProperty });
return (PropertyInputViewModel<T>) container.Resolve(viewModelType, args: [layerProperty]);
}
}
@@ -23,7 +23,7 @@
<StackPanel Grid.Row="2" Margin="20">
<TextBlock Classes="h3">Awww :(</TextBlock>
<TextBlock>
It looks like Artemis ran into an unhandled exception. If this keeps happening feel free to hit us up on Discord.
It looks like Artemis ran into an unexpected error. If this keeps happening feel free to hit us up on Discord.
</TextBlock>
</StackPanel>
@@ -42,7 +42,7 @@
</TextBlock>
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="15">
<Button Command="{CompiledBinding CopyException}" Classes="AppBarButton" Width="150" Margin="0 0 5 0">
Copy exception
Copy error
</Button>
<Button Command="{CompiledBinding Close}" Width="150" Margin="5 0 0 0">
Close