Xamarin이있는 웹보기에서 웹 응용 프로그램 (Readium)을 로컬로로드하려고합니다. 대상으로 UWP, Android 및 iOS가 있습니다. https://developer.xamarin.com/guides/xamarin-forms/user-interface/webview/에 따르면 index.html 페이지를 열 수 없으며 각 프로젝트에 웹을 포함 시켰지만 빈 페이지가 나타납니다.Xamarin Forms Webview local
, 그것은 방법 NavigateToLocalStreamUri을 사용하여, 잘 작동 이러한 그러나
assembly: Dependency(typeof(BaseUrl))]
namespace WorkingWithWebview.UWP
{
public class BaseUrl : IBaseUrl
{
public string Get()
{
return "ms-appx-web:///";
}
}
}
(자 마린)없이 새로운 UWP 프로젝트를 생성 (UWP) 각 애플리케이션에 의존 서비스를 구현 (URI, 새로운 StreamUriWinRTResolver ()) with
public IAsyncOperation<IInputStream> UriToStreamAsync(Uri uri)
{
if (uri == null)
{
throw new Exception();
}
string path = uri.AbsolutePath;
return GetContent(path).AsAsyncOperation();
}
private async Task<IInputStream> GetContent(string path)
{
try
{
Uri localUri = new Uri("ms-appx:///cloud-reader" + path);
StorageFile f = await StorageFile.GetFileFromApplicationUriAsync(localUri);
IRandomAccessStream stream = await f.OpenAsync(FileAccessMode.Read);
return stream;
}
catch (Exception)
{
throw new Exception("Invalid path");
}
}
동일한 방식으로 Xamarin Forms에서 수행 할 수 있습니까? 감사합니다.