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

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

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

                Package = package;

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

                Enabled        = true;
                CanRunElevated = CanApplicationRunElevated();
            }
Ejemplo n.º 2
0
            public Application(IAppxManifestApplication manifestApp, UWP package)
            {
                UserModelId      = manifestApp.GetAppUserModelId();
                UniqueIdentifier = manifestApp.GetAppUserModelId();
                DisplayName      = manifestApp.GetStringValue("DisplayName");
                Description      = manifestApp.GetStringValue("Description");
                BackgroundColor  = manifestApp.GetStringValue("BackgroundColor");
                Package          = package;

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

                Enabled = true;
            }
Ejemplo n.º 3
0
        public static Application[] All()
        {
            var windows10 = new Version(10, 0);
            var support   = Environment.OSVersion.Version.Major >= windows10.Major;

            if (support)
            {
                var applications = CurrentUserPackages().AsParallel().SelectMany(p =>
                {
                    UWP u;
                    try
                    {
                        u = new UWP(p);
                    }
#if !DEBUG
                    catch (Exception e)
                    {
                        ProgramLogger.LogException($"|UWP|All|{p.InstalledLocation}|An unexpected error occured and "
                                                   + $"unable to convert Package to UWP for {p.Id.FullName}", e);
                        return(new Application[] { });
                    }
#endif
#if DEBUG //make developer aware and implement handling
                    catch
                    {
                        throw;
                    }
#endif
                    return(u.Apps);
                }).ToArray();

                var updatedListWithoutDisabledApps = applications
                                                     .Where(t1 => !Main._settings.DisabledProgramSources
                                                            .Any(x => x.UniqueIdentifier == t1.UniqueIdentifier))
                                                     .Select(x => x);

                return(updatedListWithoutDisabledApps.ToArray());
            }
            else
            {
                return(new Application[] { });
            }
        }