Ejemplo n.º 1
0
            public Application(AppxPackageHelper.IAppxManifestApplication manifestApp, UWP package)
            {
                // This is done because we cannot use the keyword 'out' along with a property
                string tmpUserModelId;
                string tmpUniqueIdentifier;
                string tmpDisplayName;
                string tmpDescription;
                string tmpBackgroundColor;
                string tmpEntryPoint;

                manifestApp.GetAppUserModelId(out tmpUserModelId);
                manifestApp.GetAppUserModelId(out tmpUniqueIdentifier);
                manifestApp.GetStringValue("DisplayName", out tmpDisplayName);
                manifestApp.GetStringValue("Description", out tmpDescription);
                manifestApp.GetStringValue("BackgroundColor", out tmpBackgroundColor);
                manifestApp.GetStringValue("EntryPoint", out tmpEntryPoint);

                UserModelId      = tmpUserModelId;
                UniqueIdentifier = tmpUniqueIdentifier;
                DisplayName      = tmpDisplayName;
                Description      = tmpDescription;
                BackgroundColor  = tmpBackgroundColor;
                EntryPoint       = tmpEntryPoint;

                Package = package;

                DisplayName = ResourceFromPri(package.FullName, DisplayName);
                Description = ResourceFromPri(package.FullName, Description);
                LogoUri     = LogoUriFromManifest(manifestApp);

                Enabled        = true;
                CanRunElevated = IfApplicationcanRunElevated();
            }
Ejemplo n.º 2
0
            internal string LogoUriFromManifest(AppxPackageHelper.IAppxManifestApplication app)
            {
                var logoKeyFromVersion = new Dictionary <PackageVersion, string>
                {
                    { PackageVersion.Windows10, "Square44x44Logo" },
                    { PackageVersion.Windows81, "Square30x30Logo" },
                    { PackageVersion.Windows8, "SmallLogo" },
                };

                if (logoKeyFromVersion.ContainsKey(Package.Version))
                {
                    var key = logoKeyFromVersion[Package.Version];
                    app.GetStringValue(key, out string logoUri);
                    return(logoUri);
                }
                else
                {
                    return(string.Empty);
                }
            }