-
-
Save christiannagel/069c46a6f303002627ec0c6618f0f205 to your computer and use it in GitHub Desktop.
Return the package name of a Windows 10 app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BooksLib.Services; | |
using System; | |
using Windows.ApplicationModel; | |
namespace DesktopBridgeSample.Services | |
{ | |
public class PackageNameService : IPackageNameService | |
{ | |
public (string name, string id) GetPackageName() | |
{ | |
try | |
{ | |
Package package = Package.Current; | |
return (package.DisplayName, package.Id.FullName); | |
} | |
catch (InvalidOperationException) | |
{ | |
return ("no package", ""); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment