Skip to content
Snippets Groups Projects
Verified Commit 8d9212c7 authored by Emilia's avatar Emilia
Browse files

mutex

parent 08fc8b7c
Branches
Tags v18
Loading
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<entry key="Blacklight/Views/Utility/MarkdownText.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" /> <entry key="Blacklight/Views/Utility/MarkdownText.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" />
<entry key="Blacklight/Views/Views/ClientView.axaml" value="Blacklight/Blacklight.csproj" /> <entry key="Blacklight/Views/Views/ClientView.axaml" value="Blacklight/Blacklight.csproj" />
<entry key="Blacklight/Views/Views/SettingsView.axaml" value="Blacklight/Blacklight.csproj" /> <entry key="Blacklight/Views/Views/SettingsView.axaml" value="Blacklight/Blacklight.csproj" />
<entry key="Blacklight/Views/Windows/CreateChannelView.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" />
<entry key="Blacklight/Views/Windows/CreateChannelWindow.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" /> <entry key="Blacklight/Views/Windows/CreateChannelWindow.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" />
</map> </map>
</option> </option>
......
...@@ -6,14 +6,20 @@ namespace Blacklight.Desktop; ...@@ -6,14 +6,20 @@ namespace Blacklight.Desktop;
sealed class Program sealed class Program
{ {
private static Mutex _mutex = new Mutex(true, "{BFB1CB9E-78E6-4CC4-AB51-AD561BE8E21A}");
// Initialization code. Don't use any Avalonia, third-party APIs or any // Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break. // yet and stuff might break.
[STAThread] [STAThread]
public static void Main(string[] args) public static void Main(string[] args)
{ {
if (_mutex.WaitOne(TimeSpan.Zero, true))
{
BuildAvaloniaApp() BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args); .StartWithClassicDesktopLifetime(args);
_mutex.ReleaseMutex();
}
} }
// Avalonia configuration, don't remove; also used by visual designer. // Avalonia configuration, don't remove; also used by visual designer.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment