Meta - Fixed a bunch of build warnings

This commit is contained in:
Robert committed 2023-10-18 23:13:57 +02:00
1 parent 6921561317
commit 1bd4efbbc5
27 files changed
+199 -149

No files matched your search

@@ -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)