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(); }
public UWPApplication(IAppxManifestApplication manifestApp, UWP package) { if (manifestApp == null) { throw new ArgumentNullException(nameof(manifestApp)); } var hr = manifestApp.GetAppUserModelId(out var tmpUserModelId); UserModelId = AppxPackageHelper.CheckHRAndReturnOrThrow(hr, tmpUserModelId); hr = manifestApp.GetAppUserModelId(out var tmpUniqueIdentifier); UniqueIdentifier = AppxPackageHelper.CheckHRAndReturnOrThrow(hr, tmpUniqueIdentifier); hr = manifestApp.GetStringValue("DisplayName", out var tmpDisplayName); DisplayName = AppxPackageHelper.CheckHRAndReturnOrThrow(hr, tmpDisplayName); hr = manifestApp.GetStringValue("Description", out var tmpDescription); Description = AppxPackageHelper.CheckHRAndReturnOrThrow(hr, tmpDescription); hr = manifestApp.GetStringValue("BackgroundColor", out var tmpBackgroundColor); BackgroundColor = AppxPackageHelper.CheckHRAndReturnOrThrow(hr, tmpBackgroundColor); hr = manifestApp.GetStringValue("EntryPoint", out var tmpEntryPoint); EntryPoint = AppxPackageHelper.CheckHRAndReturnOrThrow(hr, tmpEntryPoint); Package = package ?? throw new ArgumentNullException(nameof(package)); DisplayName = ResourceFromPri(package.FullName, DisplayName); Description = ResourceFromPri(package.FullName, Description); logoUri = LogoUriFromManifest(manifestApp); Enabled = true; CanRunElevated = IfApplicationcanRunElevated(); }
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, DisplayName); Description = ResourceFromPri(package.FullName, Description); LogoUri = LogoUriFromManifest(manifestApp); LogoPath = LogoPathFromUri(LogoUri); Enabled = true; }
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 occurred 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[] { }); } }
public static UWPApplication[] 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); u.InitializeAppInfo(p.InstalledLocation); } catch (Exception e) { ProgramLogger.LogException( $"|UWP|All|{p.InstalledLocation}|An unexpected error occurred and " + $"unable to convert Package to UWP for {p.FullName}", e); return(Array.Empty <UWPApplication>()); } 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(Array.Empty <UWPApplication>()); } }
public static UWPApplication[] 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); u.InitializeAppInfo(p.InstalledLocation); } catch (Exception e) { ProgramLogger.Exception($"Unable to convert Package to UWP for {p.FullName}", e, MethodBase.GetCurrentMethod().DeclaringType, p.InstalledLocation); return(Array.Empty <UWPApplication>()); } return(u.Apps); }); var updatedListWithoutDisabledApps = applications .Where(t1 => Main.Settings.DisabledProgramSources.All(x => x.UniqueIdentifier != t1.UniqueIdentifier)) .Select(x => x); return(updatedListWithoutDisabledApps.ToArray()); } else { return(Array.Empty <UWPApplication>()); } }