Windows Phone 앱을 개발 중이며 7.1로 타겟팅하므로 wp7 및 wp8 장치에서 실행할 수 있습니다. 애플 리케이션은 WP8 장치에서 실행 경우에, 나는이 코드를 실행하고 싶습니다 :GetFileAsync가 리플렉션으로 Windows.System.Launcher.LaunchFileAsync를 호출합니다.
public async void DefaultLaunch2a()
{
// Path to the file in the app package to launch
var file1 = await ApplicationData
.Current
.LocalFolder
.GetFileAsync("webcam-file.jpg");
if (file1 != null)
{
// Launch the retrieved file
var success = await Windows.System.Launcher.LaunchFileAsync(file1);
if (success)
{
// File launched/y
}
else
{
// File launched/n
}
}
else
{
// Could not find file
}
}
런처 파일 형식 (이미지를 엽니 다). 나는 그것을 반영하려고 노력하고 있지만 어떤 종류의 문제가있다.
String name = "file1.jpg";
Type taskDataType2 = Type.GetType("Windows.Storage.StorageFolder, Windows, "
+ "Version=255.255.255.255, Culture=neutral, "
+ "PublicKeyToken=null, "
+ "ContentType=WindowsRuntime");
MethodInfo showmethod2 = taskDataType2.GetMethod("GetFileAsync",
new Type[]
{
typeof(System.String)
});
showmethod2.Invoke(taskDataType2,
new System.String[] { name });
이 코드는 예외 TargetException: Object does not match target type
가 발생합니다 - 나는 방법을 호출 할 때.
무엇이 잘못 되었나요? 이미 리플렉션을 사용하여 위의 코드를 작성하려고 시도한 사람이 있습니까? 목표는 장치 저장소에서 이미지 파일을 읽고 Windows.System.Launcher.LaunchFileAsync
을 시작하는 것입니다. 코드가 wp8 장치에서 실행중인 경우 mangopollo와 같은 작업을 수행하려고합니다.