이 항목은 아직 평가되지 않았습니다.- 이 항목 평가

Launcher Class

지정된 파일 또는 URI와 연결된 기본 앱을 시작합니다.

구문


public static class Launcher : Object

특성

MarshalingBehaviorAttribute(Standard)
StaticAttribute(Windows.System.ILauncherStatics, NTDDI_WIN8)
VersionAttribute(NTDDI_WIN8)

구성원

Launcher클래스에는 다음과 같은 유형의 구성원이 있습니다.

메서드

The Launcher 클래스 다음 메서드가 있습니다. C#, Visual Basic 및 C++에서는 다음에서 메서드를 상속합니다. Object 클래스.

메서드설명
LaunchFileAsync(IStorageFile) Starts the default app associated with the specified file.
LaunchFileAsync(IStorageFile, LauncherOptions) Starts the default app associated with the specified file, using the specified options.
LaunchUriAsync(Uri) Starts the default app associated with the URI scheme name for the specified URI.
LaunchUriAsync(Uri, LauncherOptions) Starts the default app associated with the URI scheme name for the specified URI, using the specified options.

 

설명

참고  : 이 클래스는 Agile 클래스가 아닙니다. 즉, 이 클래스의 스레딩 모델 및 마샬링 동작을 고려해야 합니다. 자세한 내용은 스레딩 및 마샬링(C++/CX)다중 스레드 환경에서 Windows 런타임 개체 사용(.NET)을 참조하십시오.

예제

이 예제에서는 LaunchFileAsync(IStorageFile) | launchFileAsync(IStorageFile)를 사용하여 앱 패키지에 포함된 파일을 시작하는 방법을 보여 줍니다.


async void DefaultLaunch()
{
   // Path to the file in the app package to launch
   string imageFile = @"images\test.png";

   var file = wait Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile);

   if (file != null)
   {
      // Launch the retrieved file
      var success = await Windows.System.Launcher.LaunchFileAsync(file);

      if (success)
      {
         // File launched
      }
      else
      {
         // File launch failed
      }
   }
   else
   {
      // Could not find file
   }
}

이 예제에서는 LaunchUriAsync(Uri) | 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
   }
}


요구 사항

지원되는 최소 클라이언트

Windows 8 [Windows 스토어 앱 전용]

지원되는 최소 서버

Windows Server 2012 [Windows 스토어 앱 전용]

지원되는 최소 전화

Windows Phone 8

네임스페이스

Windows.System
Windows::System [C++]

메타데이터

Windows.winmd

참고 항목

작업
파일의 기본 앱을 시작하는 방법(JavaScript)
파일의 기본 앱을 시작하는 방법(C#/VB/C++)
URI의 기본 앱을 시작하는 방법(JavaScript)
URI의 기본 앱을 시작하는 방법(C#/VB/C++)
샘플
연결 시작 샘플
지침
파일 형식 및 URI를 위한 지침 및 검사 목록
참조
LauncherOptions
LauncherUIOptions

 

 

이 정보가 도움이 되었습니까?
(1500자 남음)
© 2013 Microsoft. All rights reserved.