File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ open System
44open System.IO
55open System.Net
66open System.Reflection
7+ open System.Threading
78open Avalonia.Logging
89open Elmish
910open Avalonia
@@ -187,9 +188,16 @@ module Program =
187188
188189 [<EntryPoint>]
189190 let main ( args : string []) =
190- AppBuilder
191- .Configure< App>()
192- .UsePlatformDetect()
193- .LogToTrace( LogEventLevel.Warning)
194- .UseSkia()
195- .StartWithClassicDesktopLifetime( args)
191+ let mutexName = $" Global\\ {Environment.UserName}"
192+ let appUserInstanceAlreadyExists , _ = Mutex.TryOpenExisting( mutexName)
193+ if appUserInstanceAlreadyExists
194+ then
195+ 1 // Application instance for this user already launched
196+ else
197+ use mutex = new Mutex( false , mutexName)
198+ AppBuilder
199+ .Configure< App>()
200+ .UsePlatformDetect()
201+ .LogToTrace( LogEventLevel.Warning)
202+ .UseSkia()
203+ .StartWithClassicDesktopLifetime( args)
You can’t perform that action at this time.
0 commit comments