Skip to content

Commit 2c1d2ff

Browse files
committed
Refactor app name retrieval and remove single instance limit
Modified AppPaths.cs to dynamically retrieve the app's display name using AppInfo.Current.DisplayInfo.DisplayName instead of a hardcoded string. Removed single instance enforcement in App.xaml.cs, allowing multiple instances of the application to run simultaneously. Signed-off-by: Christoph Hofmann <[email protected]>
1 parent c997904 commit 2c1d2ff

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/openHAB.Core/AppPaths.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.IO;
3+
using Windows.ApplicationModel;
34

45
namespace openHAB.Core;
56

@@ -8,7 +9,7 @@ namespace openHAB.Core;
89
/// </summary>
910
public class AppPaths
1011
{
11-
private const string _applicationName = "openHAB";
12+
private static readonly string _applicationName = AppInfo.Current.DisplayInfo.DisplayName;
1213

1314
/// <summary>
1415
/// Gets the directory path for application data.

src/openHAB.Windows/App.xaml.cs

-5
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ protected override async void OnLaunched(LaunchActivatedEventArgs e)
7070
_logger.LogInformation("=== Start Application ===");
7171
_appManager.SetProgramLanguage(null);
7272

73-
// TODO This code defaults the app to a single instance app. If you need multi instance app, remove this part.
74-
// Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/applifecycle#single-instancing-in-applicationonlaunched
75-
// If this is the first instance launched, then register it as the "main" instance.
76-
// If this isn't the first instance launched, then "main" will already be registered,
77-
// so retrieve it.
7873
AppInstance mainInstance = AppInstance.FindOrRegisterForKey("main");
7974
AppActivationArguments activatedEventArgs = AppInstance.GetCurrent().GetActivatedEventArgs();
8075

0 commit comments

Comments
 (0)