Пример #1
0
        public static async Task LaunchDefault(Uri uri)
        {
            var status = await Windows.System.Launcher.QueryUriSupportAsync(
                uri, Windows.System.LaunchQuerySupportType.Uri);

            switch (status)
            {
            case Windows.System.LaunchQuerySupportStatus.Available:
                if (await Windows.System.Launcher.LaunchUriAsync(uri))
                {
                    return;
                }
                break;
            }
            throw BrowserException.FromQueryStatus(status, uri);
        }
Пример #2
0
        private static async Task LaunchEdge(Uri uri)
        {
            var opt = new Windows.System.LauncherOptions()
            {
                TargetApplicationPackageFamilyName = "Microsoft.MicrosoftEdge_8wekyb3d8bbwe"
            };
            var status = await Windows.System.Launcher.QueryUriSupportAsync(
                uri, Windows.System.LaunchQuerySupportType.Uri,
                opt.TargetApplicationPackageFamilyName);

            switch (status)
            {
            case Windows.System.LaunchQuerySupportStatus.Available:
                if (await Windows.System.Launcher.LaunchUriAsync(uri, opt))
                {
                    return;
                }
                break;
            }
            throw BrowserException.FromQueryStatus(status, uri);
        }
Пример #3
0
        public static async Task LaunchWithUI(Uri uri)
        {
            var opt = new Windows.System.LauncherOptions
            {
                DisplayApplicationPicker = true
            };

            opt.UI.InvocationPoint    = new Windows.Foundation.Point(0, 0);
            opt.UI.PreferredPlacement = Windows.UI.Popups.Placement.Below;
            var status = await Windows.System.Launcher.QueryUriSupportAsync(
                uri, Windows.System.LaunchQuerySupportType.Uri);

            switch (status)
            {
            case Windows.System.LaunchQuerySupportStatus.Available:
                if (await Windows.System.Launcher.LaunchUriAsync(uri, opt))
                {
                    return;
                }
                break;
            }
            throw BrowserException.FromQueryStatus(status, uri);
        }