mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Meta - Fixed a bunch of build warnings
This commit is contained in:
1 parent
6921561317
commit
1bd4efbbc5
27 files changed
+199
-149
No files matched your search
@@ -1,15 +1,10 @@
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using ReactiveUI;
|
||||
using RGB.NET.Core;
|
||||
@@ -50,10 +45,10 @@ public class DeviceGeneralTabViewModel : ActivatableViewModelBase
|
||||
|
||||
Device = device;
|
||||
DisplayName = "General";
|
||||
X = (int)Device.X;
|
||||
Y = (int)Device.Y;
|
||||
X = (int) Device.X;
|
||||
Y = (int) Device.Y;
|
||||
Scale = Device.Scale;
|
||||
Rotation = (int)Device.Rotation;
|
||||
Rotation = (int) Device.Rotation;
|
||||
RedScale = Device.RedScale * 100f;
|
||||
GreenScale = Device.GreenScale * 100f;
|
||||
BlueScale = Device.BlueScale * 100f;
|
||||
@@ -234,7 +229,7 @@ public class DeviceGeneralTabViewModel : ActivatableViewModelBase
|
||||
if (!DisplayOnDevices)
|
||||
return;
|
||||
|
||||
using SKPaint overlayPaint = new() { Color = CurrentColor };
|
||||
using SKPaint overlayPaint = new() {Color = CurrentColor};
|
||||
e.Canvas.DrawRect(0, 0, e.Canvas.LocalClipBounds.Width, e.Canvas.LocalClipBounds.Height, overlayPaint);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Device;
|
||||
@@ -18,17 +15,17 @@ public partial class DeviceLayoutTabView : ReactiveUserControl<DeviceLayoutTabVi
|
||||
{
|
||||
if (ViewModel?.DefaultLayoutPath is null)
|
||||
return;
|
||||
|
||||
TopLevel.GetTopLevel(this).Clipboard.SetTextAsync(ViewModel.DefaultLayoutPath);
|
||||
|
||||
TopLevel.GetTopLevel(this)?.Clipboard?.SetTextAsync(ViewModel.DefaultLayoutPath);
|
||||
ViewModel.ShowCopiedNotification();
|
||||
}
|
||||
|
||||
private void ImagePathButton_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (ViewModel?.Device?.Layout?.Image?.LocalPath is null)
|
||||
if (ViewModel?.Device.Layout?.Image?.LocalPath is null)
|
||||
return;
|
||||
|
||||
TopLevel.GetTopLevel(this).Clipboard.SetTextAsync(ViewModel.Device.Layout.Image.LocalPath);
|
||||
|
||||
TopLevel.GetTopLevel(this)?.Clipboard?.SetTextAsync(ViewModel.Device.Layout.Image.LocalPath);
|
||||
ViewModel.ShowCopiedNotification();
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,10 @@ public partial class DeviceLogicalLayoutDialogView : ReactiveUserControl<DeviceL
|
||||
RegionsAutoCompleteBox.PopulateComplete();
|
||||
}
|
||||
|
||||
private bool SearchRegions(string search, object item)
|
||||
private bool SearchRegions(string? search, object? item)
|
||||
{
|
||||
if (search == null)
|
||||
return true;
|
||||
if (item is not RegionInfo regionInfo)
|
||||
return false;
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.AdaptionHints;
|
||||
|
||||
public partial class SingleLedAdaptionHintViewModel : AdaptionHintViewModelBase
|
||||
{
|
||||
[Notify] private List<AdaptionLed> _adaptionLeds;
|
||||
[Notify] private List<AdaptionLed> _adaptionLeds = new();
|
||||
[Notify] private AdaptionLed? _selectedLed;
|
||||
|
||||
public SingleLedAdaptionHintViewModel(Layer layer, SingleLedAdaptionHint adaptionHint) : base(layer, adaptionHint)
|
||||
|
||||
@@ -5,7 +5,6 @@ using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.LogicalTree;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.ReactiveUI;
|
||||
@@ -40,7 +39,8 @@ public partial class ProfileTreeView : ReactiveUserControl<ProfileTreeViewModel>
|
||||
|
||||
private void CreateDragAdorner(DragEventArgs e)
|
||||
{
|
||||
if (_dragAdorner != null)
|
||||
Window? window = this.FindAncestorOfType<Window>();
|
||||
if (window == null || _dragAdorner != null)
|
||||
return;
|
||||
|
||||
if (e.Source is not Control c)
|
||||
@@ -55,7 +55,7 @@ public partial class ProfileTreeView : ReactiveUserControl<ProfileTreeViewModel>
|
||||
ITransform? originalTransform = container.RenderTransform;
|
||||
try
|
||||
{
|
||||
_dragStartPosition = e.GetPosition(this.FindAncestorOfType<Window>());
|
||||
_dragStartPosition = e.GetPosition(window);
|
||||
_elementDragOffset = e.GetPosition(container);
|
||||
|
||||
RenderTargetBitmap renderTarget = new(new PixelSize((int) container.Bounds.Width, (int) container.Bounds.Height));
|
||||
@@ -106,10 +106,11 @@ public partial class ProfileTreeView : ReactiveUserControl<ProfileTreeViewModel>
|
||||
|
||||
private void UpdateDragAdorner(DragEventArgs e)
|
||||
{
|
||||
if (_dragAdorner == null)
|
||||
Window? window = this.FindAncestorOfType<Window>();
|
||||
if (window == null || _dragAdorner == null)
|
||||
return;
|
||||
|
||||
Point position = e.GetPosition(this.FindAncestorOfType<Window>());
|
||||
Point position = e.GetPosition(window);
|
||||
_dragAdorner.RenderTransform = new TranslateTransform(_dragStartPosition.X - _elementDragOffset.X, position.Y - _elementDragOffset.Y);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public partial class RootView : ReactiveUserControl<RootViewModel>
|
||||
this.WhenActivated(d => ViewModel.WhenAnyValue(vm => vm.Screen).Subscribe(Navigate).DisposeWith(d));
|
||||
}
|
||||
|
||||
private void Navigate(RoutableScreen viewModel)
|
||||
private void Navigate(RoutableScreen? viewModel)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ public partial class ReleasesTabView : ReactiveUserControl<ReleasesTabViewModel>
|
||||
{
|
||||
ReleaseFrame.NavigateFromObject(viewModel);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
@@ -202,14 +202,17 @@ public class ProfileConfigurationEditViewModel : DialogViewModelBase<ProfileConf
|
||||
{
|
||||
// Preselect the icon based on streams if needed
|
||||
if (_profileConfiguration.Icon.IconType == ProfileConfigurationIconType.BitmapImage)
|
||||
{
|
||||
try
|
||||
{
|
||||
SelectedBitmapSource = new Bitmap(_profileConfiguration.Icon.GetIconStream());
|
||||
Stream? iconStream = _profileConfiguration.Icon.GetIconStream();
|
||||
SelectedBitmapSource = iconStream != null ? new Bitmap(iconStream) : null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_windowService.ShowConfirmContentDialog("Failed to load profile icon", e.Message, "Meh", null);
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare the contents of the dropdown box, it should be virtualized so no need to wait with this
|
||||
ObservableCollection<ProfileIconViewModel> icons = new(Enum.GetValues<MaterialIconKind>()
|
||||
|
||||
@@ -49,7 +49,8 @@ public partial class SidebarCategoryView : ReactiveUserControl<SidebarCategoryVi
|
||||
|
||||
private void CreateDragAdorner(DragEventArgs e)
|
||||
{
|
||||
if (_dragAdorner != null)
|
||||
Window? window = this.FindAncestorOfType<Window>();
|
||||
if (window == null || _dragAdorner != null)
|
||||
return;
|
||||
|
||||
if (e.Source is not Control c)
|
||||
@@ -64,7 +65,7 @@ public partial class SidebarCategoryView : ReactiveUserControl<SidebarCategoryVi
|
||||
ITransform? originalTransform = container.RenderTransform;
|
||||
try
|
||||
{
|
||||
_dragStartPosition = e.GetPosition(this.FindAncestorOfType<Window>());
|
||||
_dragStartPosition = e.GetPosition(window);
|
||||
_elementDragOffset = e.GetPosition(container);
|
||||
|
||||
RenderTargetBitmap renderTarget = new(new PixelSize((int) container.Bounds.Width, (int) container.Bounds.Height));
|
||||
@@ -88,7 +89,9 @@ public partial class SidebarCategoryView : ReactiveUserControl<SidebarCategoryVi
|
||||
|
||||
private void HandleDragOver(object? sender, DragEventArgs e)
|
||||
{
|
||||
UpdateDragAdorner(e.GetPosition(this.FindAncestorOfType<Window>()));
|
||||
Window? window = this.FindAncestorOfType<Window>();
|
||||
if (window != null)
|
||||
UpdateDragAdorner(e.GetPosition(window));
|
||||
}
|
||||
|
||||
private void HandleLeaveEvent(object? sender, RoutedEventArgs e)
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
|
||||
using System;
|
||||
using System.Reactive;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Routing;
|
||||
using Artemis.WebClient.Workshop;
|
||||
using Artemis.WebClient.Workshop.Services;
|
||||
using ReactiveUI;
|
||||
|
||||
@@ -14,7 +12,7 @@ public class WorkshopOfflineViewModel : RoutableScreen<WorkshopOfflineParameters
|
||||
{
|
||||
private readonly IRouter _router;
|
||||
private readonly IWorkshopService _workshopService;
|
||||
private string _message;
|
||||
private string _message = string.Empty;
|
||||
|
||||
/// <inheritdoc />
|
||||
public WorkshopOfflineViewModel(IWorkshopService workshopService, IRouter router)
|
||||
@@ -51,5 +49,5 @@ public class WorkshopOfflineViewModel : RoutableScreen<WorkshopOfflineParameters
|
||||
|
||||
public class WorkshopOfflineParameters
|
||||
{
|
||||
public string Message { get; set; }
|
||||
public string Message { get; set; } = string.Empty;
|
||||
}
|
||||
Reference in new issue
Block a user