Launcher.LaunchUriAsync 메서드

정의

오버로드

LaunchUriAsync(Uri, LauncherOptions, ValueSet)

지정된 옵션 및 입력 데이터를 사용하여 지정된 URI의 URI 체계 이름과 연결된 기본 앱을 시작합니다.

LaunchUriAsync(Uri, LauncherOptions)

지정된 옵션을 사용하여 URI 체계 이름과 연결된 기본 앱 또는 지정된 URI에 대해 ContentType 에서 지정한 앱을 시작합니다.

LaunchUriAsync(Uri)

지정된 URI의 URI 체계 이름과 연결된 기본 앱을 시작합니다.

LaunchUriAsync(Uri, LauncherOptions, ValueSet)

지정된 옵션 및 입력 데이터를 사용하여 지정된 URI의 URI 체계 이름과 연결된 기본 앱을 시작합니다.

public:
 static IAsyncOperation<bool> ^ LaunchUriAsync(Uri ^ uri, LauncherOptions ^ options, ValueSet ^ inputData);
/// [Windows.Foundation.Metadata.Overload("LaunchUriWithDataAsync")]
 static IAsyncOperation<bool> LaunchUriAsync(Uri const& uri, LauncherOptions const& options, ValueSet const& inputData);
[Windows.Foundation.Metadata.Overload("LaunchUriWithDataAsync")]
public static IAsyncOperation<bool> LaunchUriAsync(System.Uri uri, LauncherOptions options, ValueSet inputData);
function launchUriAsync(uri, options, inputData)
Public Shared Function LaunchUriAsync (uri As Uri, options As LauncherOptions, inputData As ValueSet) As IAsyncOperation(Of Boolean)

매개 변수

uri
Uri Uri

URI입니다.

options
LauncherOptions

앱의 시작 옵션입니다.

inputData
ValueSet

앱의 입력 데이터입니다.

중요

전송할 수 있는 데이터의 양은 100KB를 초과하면 안 됩니다.

반환

URI 스키마의 기본 앱이 시작된 경우 true 를 반환합니다. false 이면 이고, 그렇지 않으면 입니다.

특성

설명

Windows 데스크톱 애플리케이션에서 이 API를 호출하지 않는 한 ASTA 스레드(UI 스레드라고도 함) 내에서 이 API를 호출해야 합니다.

이 API는 Windows 데스크톱 애플리케이션에서 호출될 수도 있습니다.

이 API는 유니버설 Windows 플랫폼(UWP) 앱이든 Windows 데스크톱 애플리케이션이든 관계없이 스키마에 대한 기본 앱을 시작합니다.

추가 정보

적용 대상

LaunchUriAsync(Uri, LauncherOptions)

지정된 옵션을 사용하여 URI 체계 이름과 연결된 기본 앱 또는 지정된 URI에 대해 ContentType 에서 지정한 앱을 시작합니다.

public:
 static IAsyncOperation<bool> ^ LaunchUriAsync(Uri ^ uri, LauncherOptions ^ options);
/// [Windows.Foundation.Metadata.Overload("LaunchUriWithOptionsAsync")]
 static IAsyncOperation<bool> LaunchUriAsync(Uri const& uri, LauncherOptions const& options);
[Windows.Foundation.Metadata.Overload("LaunchUriWithOptionsAsync")]
public static IAsyncOperation<bool> LaunchUriAsync(System.Uri uri, LauncherOptions options);
function launchUriAsync(uri, options)
Public Shared Function LaunchUriAsync (uri As Uri, options As LauncherOptions) As IAsyncOperation(Of Boolean)

매개 변수

uri
Uri Uri

URI입니다.

options
LauncherOptions

앱의 시작 옵션입니다.

반환

URI 스키마의 기본 앱이 시작된 경우 true 를 반환합니다. false 이면 이고, 그렇지 않으면 입니다.

특성

예제

이 샘플에서는 [LaunchUriAsync(Uri, LauncherOptions)를 사용하여 경고와 함께 URI를 시작합니다. TreatAsUntrusted 속성은 시스템에서 경고를 표시해야 했음을 나타냅니다.

// The URI to launch
string uriToLaunch = @"http://www.bing.com";
var uri = new Uri(uriToLaunch);

async void DefaultLaunch()
{
   // Set the option to show a warning
   var options = new Windows.System.LauncherOptions();
   options.TreatAsUntrusted = true;

   // Launch the URI with a warning prompt
   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"http://www.bing.com" };

Windows::Foundation::IAsyncAction MainPage::DefaultLaunch()
{
    // Set the option to show a warning
    Windows::System::LauncherOptions launcherOptions;
    launcherOptions.TreatAsUntrusted(true);

    // 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("http://www.bing.com");

void MainPage::DefaultLaunch()
{
   // Set the option to show a warning
   auto launchOptions = ref new Windows::System::LauncherOptions();
   launchOptions->TreatAsUntrusted = true;

   // Launch the URI with a warning prompt
   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("http://www.bing.com")

async Sub DefaultLaunch()

   ' Set the option to show a warning
   Dim options = Windows.System.LauncherOptions()
   options.TreatAsUntrusted = True

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

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

End Sub

설명

Windows 데스크톱 애플리케이션에서 이 API를 호출하지 않는 한 ASTA 스레드(UI 스레드라고도 함) 내에서 이 API를 호출해야 합니다.

이 API는 Windows 데스크톱 애플리케이션에서 호출될 수도 있습니다.

이 API는 유니버설 Windows 플랫폼(UWP) 앱이든 Windows 데스크톱 애플리케이션이든 관계없이 스키마에 대한 기본 앱을 시작합니다.

호출 앱은 이 API가 호출될 때 사용자에게 표시되어야 합니다.

Windows 데스크톱 애플리케이션에서 이 API를 호출하지 않는 한 이 API는 ASTA 스레드(UI 스레드라고도 함) 내에서 호출되어야 합니다.

인트라넷 URI(예: 네트워크 위치를 가리키는 file:/// URI)를 시작하려면 매니페스트에서 privateNetworkClientServer 기능을 지정해야 합니다.

이 메서드를 사용하여 로컬 영역에서 URI를 시작할 수 없습니다. 예를 들어 앱은 file:/// 프로토콜을 사용하여 로컬 컴퓨터의 파일에 액세스할 수 없습니다. 대신 스토리지 API 를 사용하여 파일에 액세스해야 합니다.

콘텐츠 형식은 확장명에서 기본 앱이 선택된 파일 확장자를 계산하는 데 사용됩니다. 예를 들어 ""application/vnd.ms-word.document.12"의 콘텐츠 형식 값은 ".docx"에 매핑된 다음 ".docx"에 대한 기본 애플리케이션이 시작됩니다. 예를 들면 다음과 같습니다.

// this specifies the file type, which is used to bind to Word. 
launcherOptions.ContentType = "application/vnd.ms-word.document.12"; 
// and then this launches the file using the application
Launcher.LaunchUriAsync("http://www.cloud.com/file.docx", options);

위의 이유로 인해 시작이 실패하면 API가 성공하고 비동기 작업에서 FALSE를 반환합니다.

사용자가 기본 앱을 시작하는 대신 앱을 선택할 수 있도록 하려면 LauncherOptions.DisplayApplicationPicker 속성을 설정합니다.

URI가 안전하지 않을 수 있다는 경고를 표시하려면 LauncherOptions.TreatAsUntrusted 속성을 설정합니다.

URI는 연결된 앱에 전달됩니다. 연결된 앱이 데스크톱 앱인 경우 URI는 셸 실행 메커니즘을 사용하여 전달됩니다.

추가 정보

적용 대상

LaunchUriAsync(Uri)

지정된 URI의 URI 체계 이름과 연결된 기본 앱을 시작합니다.

public:
 static IAsyncOperation<bool> ^ LaunchUriAsync(Uri ^ uri);
/// [Windows.Foundation.Metadata.Overload("LaunchUriAsync")]
 static IAsyncOperation<bool> LaunchUriAsync(Uri const& uri);
[Windows.Foundation.Metadata.Overload("LaunchUriAsync")]
public static IAsyncOperation<bool> LaunchUriAsync(System.Uri uri);
function launchUriAsync(uri)
Public Shared Function LaunchUriAsync (uri As Uri) As IAsyncOperation(Of Boolean)

매개 변수

uri
Uri Uri

URI입니다.

반환

URI 스키마의 기본 앱이 시작된 경우 true 를 반환합니다. false 이면 이고, 그렇지 않으면 입니다.

특성

예제

이 예제에서는 LaunchUriAsync(Uri) 를 사용하여 URI를 시작합니다.

// The URI to launch
string uriToLaunch = @"http://www.bing.com";

// Create a Uri object from a URI string 
var uri = new Uri(uriToLaunch);

// Launch the URI
async void DefaultLaunch()
{
   // Launch the URI
   var success = await Windows.System.Launcher.LaunchUriAsync(uri);

   if (success)
   {
      // URI launched
   }
   else
   {
      // URI launch failed
   }
}
// The URI to launch.
Windows::Foundation::Uri m_uri{ L"http://www.bing.com" };
...
Windows::Foundation::IAsyncAction MainPage::DefaultLaunch()
{
    // Launch the URI.
    if (co_await Windows::System::Launcher::LaunchUriAsync(m_uri))
    {
        // URI launched.
    }
    else
    {
        // URI launch failed.
    }
}
// The URI to launch
auto uri = ref new Windows::Foundation::Uri("http://www.bing.com");

void MainPage::DefaultLaunch()
{
   // Launch the URI
   concurrency::task<bool> launchUriOperation(Windows::System::Launcher::LaunchUriAsync(uri));
   launchUriOperation.then([](bool success)
   {
      if (success)
      {
         // URI launched
      }
      else
      {
         // URI launch failed
      }
   });
}
' The URI to launch
Dim uri As New Uri("http://www.bing.com")

async Sub DefaultLaunch()

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

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

End Sub

설명

Windows 데스크톱 애플리케이션에서 이 API를 호출하지 않는 한 ASTA 스레드(UI 스레드라고도 함) 내에서 이 API를 호출해야 합니다.

이 API는 Windows 데스크톱 애플리케이션에서 호출될 수도 있습니다.

이 API는 유니버설 Windows 플랫폼(UWP) 앱이든 Windows 데스크톱 애플리케이션이든 관계없이 스키마에 대한 기본 앱을 시작합니다.

호출 앱은 API가 호출될 때 사용자에게 표시되어야 합니다.

인트라넷 URI(예: 네트워크 위치를 가리키는 file:/// URI)를 시작하려면 매니페스트에서 privateNetworkClientServer 기능을 지정해야 합니다.

이 메서드를 사용하여 로컬 영역에서 URI를 시작할 수 없습니다. 예를 들어 앱은 file:/// 프로토콜을 사용하여 로컬 컴퓨터의 파일에 액세스할 수 없습니다. 대신 스토리지 API 를 사용하여 파일에 액세스해야 합니다.

위의 이유로 인해 시작이 실패하면 API가 성공하고 비동기 작업에서 FALSE를 반환합니다.

사용자가 기본 앱을 시작하는 대신 앱을 선택할 수 있도록 하려면 LauncherOptions.DisplayApplicationPicker 속성을 설정합니다.

URI가 안전하지 않을 수 있다는 경고를 표시하려면 LauncherOptions.TreatAsUntrusted 속성을 설정합니다.

URI는 연결된 앱에 전달됩니다. 연결된 앱이 데스크톱 앱인 경우 URI는 셸 실행 메커니즘을 사용하여 전달됩니다.

추가 정보

적용 대상