Windows - Fix crash when clicking on update notification

Meta - Code cleanup
This commit is contained in:
Robert committed 2022-09-03 10:34:53 +02:00
1 parent cdd814d920
commit 3994b49f08
36 files changed
+201 -193

No files matched your search

@@ -4,7 +4,6 @@ using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Interactivity;
using Avalonia.Xaml.Interactivity;
using FluentAvalonia.UI.Controls;
namespace Artemis.UI.Shared.Behaviors;
@@ -19,12 +19,12 @@ public interface IMainWindowService : IArtemisSharedUIService
void ConfigureMainWindowProvider(IMainWindowProvider mainWindowProvider);
/// <summary>
/// Opens the main window if it is not already open
/// Opens the main window if it is not already open, must be called on the UI thread
/// </summary>
void OpenMainWindow();
/// <summary>
/// Closes the main window if it is not already closed
/// Closes the main window if it is not already closed, must be called on the UI thread
/// </summary>
void CloseMainWindow();
@@ -37,7 +37,7 @@ public interface IMainWindowService : IArtemisSharedUIService
/// Occurs when the main window has been closed
/// </summary>
public event EventHandler? MainWindowClosed;
/// <summary>
/// Occurs when the main window has been focused
/// </summary>
@@ -15,7 +15,7 @@ internal class MainWindowService : IMainWindowService
{
MainWindowClosed?.Invoke(this, EventArgs.Empty);
}
protected virtual void OnMainWindowFocused()
{
MainWindowFocused?.Invoke(this, EventArgs.Empty);
@@ -53,7 +53,7 @@ internal class MainWindowService : IMainWindowService
{
SyncWithManager();
}
private void HandleMainWindowFocused(object? sender, EventArgs e)
{
OnMainWindowFocused();
@@ -83,7 +83,7 @@ internal class MainWindowService : IMainWindowService
_mainWindowManager.MainWindowClosed += HandleMainWindowClosed;
_mainWindowManager.MainWindowFocused += HandleMainWindowFocused;
_mainWindowManager.MainWindowUnfocused += HandleMainWindowUnfocused;
// Sync up with the new manager's state
SyncWithManager();
}
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq;
using Artemis.Core;
namespace Artemis.UI.Shared.Services.NodeEditor.Commands;
@@ -9,9 +8,9 @@ namespace Artemis.UI.Shared.Services.NodeEditor.Commands;
/// </summary>
public class ConnectPins : INodeEditorCommand
{
private readonly IPin _output;
private readonly IPin _input;
private readonly IPin? _originalConnection;
private readonly IPin _output;
/// <summary>
/// Creates a new instance of the <see cref="ConnectPins" /> class.
@@ -31,7 +31,7 @@ public class NodeConnectionStore
public void Store()
{
_pinConnections.Clear();
// Iterate to save
foreach (IPin nodePin in Node.Pins.ToList())
_pinConnections.Add(nodePin, new List<IPin>(nodePin.ConnectedTo));