Skip to content

Instantly share code, notes, and snippets.

@christiannagel
Created October 2, 2018 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiannagel/069c46a6f303002627ec0c6618f0f205 to your computer and use it in GitHub Desktop.
Save christiannagel/069c46a6f303002627ec0c6618f0f205 to your computer and use it in GitHub Desktop.
Return the package name of a Windows 10 app
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