Share via


LauncherOptions.FallbackUri 속성

정의

파일 형식 또는 URI를 처리하는 앱이 없는 경우 브라우저에서 사용자가 이동해야 하는 URI를 나타내는 값을 가져오거나 설정합니다.

public:
 property Uri ^ FallbackUri { Uri ^ get(); void set(Uri ^ value); };
Uri FallbackUri();

void FallbackUri(Uri value);
public System.Uri FallbackUri { get; set; }
var uri = launcherOptions.fallbackUri;
launcherOptions.fallbackUri = uri;
Public Property FallbackUri As Uri

속성 값

브라우저에서 사용자를 이동해야 하는 URI입니다.

예제

fallbackUri가 대체 URI로 설정된 Launcher.LaunchFileAsync(IStorageFile, LauncherOptions) | launchFileAsync(IStorageFile, LauncherOptions) 메서드를 호출합니다.

// The URI to launch
string uriToLaunch = @ "contoso:somearguments";
var uri = new Uri(uriToLaunch);

// The fallback URI
string uriFallback = @ "http://www.contoso.com/somearguments";
var fallbackUri = new Uri(fallbackUri);

async void DefaultLaunch()
{
   // Set the fallback URI
   var options = new Windows.System.LauncherOptions();
   options.FallbackUri = fallbackUri;

   // Launch the URI with the fallback URI
   var success = await Windows.System.Launcher.LaunchUriAsync(uri, options);

   if (success)
   {
      // URI launched
   }
   else
   {
      // URI launch failed
   }
}
// The URI to launch.
Windows::Foundation::Uri m_uri{ L"contoso:somearguments" };

// The fallback URI.
Windows::Foundation::Uri m_fallbackUri{ L"http://www.contoso.com/somearguments" };

Windows::Foundation::IAsyncAction MainPage::DefaultLaunch()
{
    // Set the fallback URI.
    Windows::System::LauncherOptions launcherOptions;
    launcherOptions.FallbackUri(m_fallbackUri);

    // Launch the URI.
    if (co_await Windows::System::Launcher::LaunchUriAsync(m_uri, launcherOptions))
    {
        // URI launched.
    }
    else
    {
        // URI launch failed.
    }
}
// The URI to launch
auto uri = ref new Windows::Foundation::Uri("contoso:somearguments");

// The fallback URI
auto fallbackUri = ref new Windows::Foundation::Uri("http://www.contoso.com/somearguments");

void MainPage::DefaultLaunch()
{
   // Set the fallback URI
   auto launchOptions = ref new Windows::System::LauncherOptions();
   launchOptions->FallbackUri = fallbackUri;

   // Launch the URI with the fallback URI
   concurrency::task<bool> launchUriOperation(Windows::System::Launcher::LaunchUriAsync(uri, launchOptions));
   launchUriOperation.then([](bool success)
   {
      if (success)
      {
         // URI launched
      }
      else
      {
         // URI launch failed
      }
   });
}
' The URI to launch
Dim uri As New Uri("contoso:somearguments")

' The fallback URI
Dim fallbackUri As New Uri("http://www.contoso.com/somearguments")

async Sub DefaultLaunch()

   ' Set the fallback URI
   Dim options = Windows.System.LauncherOptions()
   options.FallbackUri = fallbackUri

   ' Launch the URI with the fallback URI
   Dim success = await Windows.System.Launcher.LaunchUriAsync(uri, options)

   If success Then
      ' URI launched
   Else
      ' URI launch failed
   End If

End Sub

설명

http:// 또는 https:// URI를 사용하여 대체 URI 속성만 설정할 수 있습니다. 이 속성이 설정되고 시작 중인 파일 또는 URI를 처리하기 위해 설치된 앱이 없는 경우 사용자의 기본 브라우저가 자동으로 시작되고 지정된 URI로 이동됩니다. 이 경우 옵션을 선택하라는 대화 상자가 사용자에게 표시되지 않습니다. 파일 또는 URI가 스토어에 나열되지 않은 데스크톱 앱에서만 지원되는 경우와 같이 사용자를 Microsoft Store로 안내하는 경우에만 대체 URI를 사용해야 합니다. 시작하려는 파일 또는 URI를 지원하는 앱이 Microsoft Store에 있는 모든 경우 PreferredApplicationPackageFamilyNamePreferredApplicationDisplayName 을 사용하여 사용자에게 해당 앱을 추천해야 합니다.

하나의 대체만 사용할 수 있으므로 기본 설정 애플리케이션 속성과 대체 URI를 동시에 설정할 수 없습니다. 두 대체 항목이 모두 설정되면 Launcher API가 실패합니다.

Windows 8.1 Windows 8.1 이 속성은 Microsoft Store URI도 허용합니다. 이러한 URI는 PreferredApplicationPackageFamilyNamePreferredApplicationDisplayName 속성의 대안으로 사용하여 Open With 대화 상자를 표시하지 않고 스토어의 특정 앱으로 사용자를 보낼 수 있습니다. 이 기능은 Windows Phone 8.1 또는 수렴형 Windows 10 앱에서 지원되지 않으며 사용하지 않는 것이 좋습니다.

적용 대상

추가 정보