예제 #1
0
        private static Uri GetSafeAppInstallerInfo()
        {
            Uri result = null;

            try
            {
                if (OSVersionHelper.WindowsVersionHelper.IsWindows10October2018OrGreater &&
                    OSVersionHelper.WindowsVersionHelper.HasPackageIdentity &&
                    Windows.Foundation.Metadata.ApiInformation.IsMethodPresent("Windows.ApplicationModel.Package", "GetAppInstallerInfo"))
                {
                    result = WinRTMethods.GetAppInstallerInfoUri();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
            return(result);
        }
예제 #2
0
        public static string GetSafeInstallUri(Package p)
        {
            string result = string.Empty;

            if (ApiInformation.IsMethodPresent("Windows.ApplicationModel.Package", "GetAppInstallerInfo"))
            {
                Uri aiUri = WinRTMethods.GetAppInstallerInfoUri(p);
                if (aiUri != null)
                {
                    result = aiUri.ToString();
                }
                else
                {
                    result = "not present";
                }
            }
            else
            {
                result = "not available on this platform";
            }

            return(result);
        }