From 07a8579a01e4181a3b978d63c9cb86ea167f86e6 Mon Sep 17 00:00:00 2001 From: abdesol Date: Sat, 1 Jan 2022 20:59:33 +0300 Subject: [PATCH 1/2] changed target framework --- CutCode.CrossPlatform/CutCode.CrossPlatform.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CutCode.CrossPlatform/CutCode.CrossPlatform.csproj b/CutCode.CrossPlatform/CutCode.CrossPlatform.csproj index fd877ad..aa6d9db 100644 --- a/CutCode.CrossPlatform/CutCode.CrossPlatform.csproj +++ b/CutCode.CrossPlatform/CutCode.CrossPlatform.csproj @@ -1,7 +1,7 @@  WinExe - net5.0 + net6.0 enable From b1bb40506f07425f97c046eed23af7ca04730b2a Mon Sep 17 00:00:00 2001 From: abdesol Date: Sat, 1 Jan 2022 21:28:35 +0300 Subject: [PATCH 2/2] added process check to the program --- CutCode.CrossPlatform/Program.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CutCode.CrossPlatform/Program.cs b/CutCode.CrossPlatform/Program.cs index 0e1a9c3..22516df 100644 --- a/CutCode.CrossPlatform/Program.cs +++ b/CutCode.CrossPlatform/Program.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.ReactiveUI; @@ -12,9 +13,10 @@ class Program [STAThread] public static void Main(string[] args) { - - BuildAvaloniaApp() - .StartWithClassicDesktopLifetime(args); + var isRunningInAnotherInstance = Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetEntryAssembly().Location)).Length > 1; + if(!isRunningInAnotherInstance) + BuildAvaloniaApp() + .StartWithClassicDesktopLifetime(args); } // Avalonia configuration, don't remove; also used by visual designer.