diff --git a/.idea/.idea.Nebula/.idea/avalonia.xml b/.idea/.idea.Nebula/.idea/avalonia.xml
index 3173589..d47b2b0 100644
--- a/.idea/.idea.Nebula/.idea/avalonia.xml
+++ b/.idea/.idea.Nebula/.idea/avalonia.xml
@@ -45,6 +45,7 @@
+
diff --git a/Nebula.Launcher/App.axaml.cs b/Nebula.Launcher/App.axaml.cs
index 9628f97..7f54011 100644
--- a/Nebula.Launcher/App.axaml.cs
+++ b/Nebula.Launcher/App.axaml.cs
@@ -28,14 +28,16 @@ public class App : Application
{
case IClassicDesktopStyleApplicationLifetime desktop:
DisableAvaloniaDataAnnotationValidation();
- desktop.MainWindow = new MessageWindow(out provider);
+ desktop.MainWindow = (Window)(provider = new MessageWindow());
break;
case ISingleViewApplicationLifetime singleViewPlatform:
- singleViewPlatform.MainView = new MessageView(out provider);
+ singleViewPlatform.MainView = (Control)(provider = new MessageView());
break;
}
- provider?.ShowMessage("Launcher is already running.","hey shithead!");
+ provider?.ShowMessage(
+ "Error: An instance of the application is already running. Please close the existing instance before launching a new one.",
+ "Duplicate instance detected.");
return;
}
diff --git a/Nebula.Launcher/Assets/error_presentation/Cinka.png b/Nebula.Launcher/Assets/error_presentation/Cinka.png
new file mode 100644
index 0000000..6fb56ca
Binary files /dev/null and b/Nebula.Launcher/Assets/error_presentation/Cinka.png differ
diff --git a/Nebula.Launcher/Assets/error_presentation/alex.png b/Nebula.Launcher/Assets/error_presentation/alex.png
new file mode 100644
index 0000000..7403bcb
Binary files /dev/null and b/Nebula.Launcher/Assets/error_presentation/alex.png differ
diff --git a/Nebula.Launcher/Converters/TypeConverters.cs b/Nebula.Launcher/Converters/TypeConverters.cs
index 261ed4a..91c2617 100644
--- a/Nebula.Launcher/Converters/TypeConverters.cs
+++ b/Nebula.Launcher/Converters/TypeConverters.cs
@@ -1,11 +1,11 @@
-using Avalonia;
-using Avalonia.Controls;
+using System;
using Avalonia.Data.Converters;
using Avalonia.Media;
+using Avalonia.Platform;
namespace Nebula.Launcher.Converters;
-public class TypeConverters
+public static class TypeConverters
{
public static FuncValueConverter IconConverter { get; } =
new(iconKey =>
@@ -13,4 +13,11 @@ public class TypeConverters
if (iconKey == null) return null;
return $"/Assets/svg/{iconKey}.svg";
});
+
+ public static FuncValueConverter ImageConverter { get; } =
+ new(iconKey =>
+ {
+ if (iconKey == null) return null;
+ return new Avalonia.Media.Imaging.Bitmap(AssetLoader.Open(new Uri($"avares://Nebula.Launcher/Assets/error_presentation/{iconKey}.png")));
+ });
}
\ No newline at end of file
diff --git a/Nebula.Launcher/MessageBox/MessageView.axaml b/Nebula.Launcher/MessageBox/MessageView.axaml
index 5c39b61..2336234 100644
--- a/Nebula.Launcher/MessageBox/MessageView.axaml
+++ b/Nebula.Launcher/MessageBox/MessageView.axaml
@@ -2,16 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:views="clr-namespace:Nebula.Launcher.Views"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
- Width="600"
- Height="400"
+
x:Class="Nebula.Launcher.MessageBox.MessageView">
-
-
-
-
-
-
-
-
+
diff --git a/Nebula.Launcher/MessageBox/MessageView.axaml.cs b/Nebula.Launcher/MessageBox/MessageView.axaml.cs
index 85d80ae..b06c082 100644
--- a/Nebula.Launcher/MessageBox/MessageView.axaml.cs
+++ b/Nebula.Launcher/MessageBox/MessageView.axaml.cs
@@ -1,21 +1,22 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Nebula.Launcher.ViewModels;
namespace Nebula.Launcher.MessageBox;
public partial class MessageView : UserControl, IMessageContainerProvider
{
- public MessageView(out IMessageContainerProvider provider)
+ private readonly VisualErrorViewModel _context;
+ public MessageView()
{
InitializeComponent();
- provider = this;
+ _context = new VisualErrorViewModel();
+ ErrorView.Content = _context;
}
public void ShowMessage(string message, string title)
{
- Title.Content = title;
- Message.Content = message;
+ _context.Title = title;
+ _context.Description = message;
}
}
diff --git a/Nebula.Launcher/MessageBox/MessageWindow.axaml b/Nebula.Launcher/MessageBox/MessageWindow.axaml
index 581b1f1..29f4e9c 100644
--- a/Nebula.Launcher/MessageBox/MessageWindow.axaml
+++ b/Nebula.Launcher/MessageBox/MessageWindow.axaml
@@ -3,10 +3,52 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:messageBox="clr-namespace:Nebula.Launcher.MessageBox"
- mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+ SystemDecorations="BorderOnly"
+ mc:Ignorable="d" d:DesignWidth="600" d:DesignHeight="260"
Width="600"
- Height="400"
+ Height="260"
+ CanResize="False"
x:Class="Nebula.Launcher.MessageBox.MessageWindow"
Title="MessageWindow">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Nebula.Launcher/MessageBox/MessageWindow.axaml.cs b/Nebula.Launcher/MessageBox/MessageWindow.axaml.cs
index d7c2b3b..9456366 100644
--- a/Nebula.Launcher/MessageBox/MessageWindow.axaml.cs
+++ b/Nebula.Launcher/MessageBox/MessageWindow.axaml.cs
@@ -1,12 +1,28 @@
using Avalonia.Controls;
+using Avalonia.Input;
+using Avalonia.Interactivity;
namespace Nebula.Launcher.MessageBox;
-public partial class MessageWindow : Window
+public partial class MessageWindow : Window, IMessageContainerProvider
{
- public MessageWindow(out IMessageContainerProvider provider)
+ public MessageWindow()
{
InitializeComponent();
- Content = new MessageView(out provider);
+ }
+
+ public void ShowMessage(string message, string title)
+ {
+ MessageView.ShowMessage(message, title);
+ }
+
+ private void Close_Click(object? sender, RoutedEventArgs e)
+ {
+ Close();
+ }
+
+ private void InputElement_OnPointerPressed(object? sender, PointerPressedEventArgs e)
+ {
+ BeginMoveDrag(e);
}
}
\ No newline at end of file
diff --git a/Nebula.Launcher/ViewModels/VisualErrorViewModel.cs b/Nebula.Launcher/ViewModels/VisualErrorViewModel.cs
new file mode 100644
index 0000000..9437a6c
--- /dev/null
+++ b/Nebula.Launcher/ViewModels/VisualErrorViewModel.cs
@@ -0,0 +1,22 @@
+using CommunityToolkit.Mvvm.ComponentModel;
+using Nebula.Launcher.Views;
+using Nebula.Shared.ViewHelper;
+
+namespace Nebula.Launcher.ViewModels;
+
+
+[ViewModelRegister(typeof(VisualErrorView))]
+public partial class VisualErrorViewModel : ViewModelBase
+{
+ [ObservableProperty] private string _imgPath = "cinka";
+ [ObservableProperty] private string _title = "Error";
+ [ObservableProperty] private string _description = "This is an error.";
+
+ protected override void InitialiseInDesignMode()
+ {
+ }
+
+ protected override void Initialise()
+ {
+ }
+}
\ No newline at end of file
diff --git a/Nebula.Launcher/Views/VisualErrorView.axaml b/Nebula.Launcher/Views/VisualErrorView.axaml
new file mode 100644
index 0000000..5068a32
--- /dev/null
+++ b/Nebula.Launcher/Views/VisualErrorView.axaml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Nebula.Launcher/Views/VisualErrorView.axaml.cs b/Nebula.Launcher/Views/VisualErrorView.axaml.cs
new file mode 100644
index 0000000..5d88fbd
--- /dev/null
+++ b/Nebula.Launcher/Views/VisualErrorView.axaml.cs
@@ -0,0 +1,11 @@
+using Avalonia.Controls;
+
+namespace Nebula.Launcher.Views;
+
+public partial class VisualErrorView : UserControl
+{
+ public VisualErrorView()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/Nebula.sln.DotSettings.user b/Nebula.sln.DotSettings.user
index 114714c..8a0555d 100644
--- a/Nebula.sln.DotSettings.user
+++ b/Nebula.sln.DotSettings.user
@@ -20,6 +20,7 @@
ForceIncluded
ForceIncluded
ForceIncluded
+ ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded
@@ -32,6 +33,7 @@
ForceIncluded
ForceIncluded
ForceIncluded
+ ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded