0
でフルサイズです:はどのように私はそれで画像を開くことができ、私はチャットアプリに取り組んでいますUWP
ユーザーが画像をタップした場合、それがフルサイズで表示されます。以下のメソッドが呼び出されます。
Handle_Tapped():
void Handle_Tapped(object sender, System.EventArgs e)
{
try
{
Image image = sender as Image;
string filePath = String.Empty;
filePath = image.Source as FileImageSource;
Eva3Toolkit.CommonUtils.openImage(filePath);
}
catch (Exception ex)
{
throw ex;
}
}
(OSに依存)を呼び出します
:アンドロイドで
openImage()
:
public void openImage(string filePath)
{
Intent sendIntent = new Intent(Intent.ActionView);
sendIntent.SetDataAndType(Android.Net.Uri.Parse("file:" + filePath), "image/*");
Forms.Context.StartActivity(Intent.CreateChooser(sendIntent, "Bild öffnen..."));
}
iOSのopenImage()
:
public void openImage(string filePath)
{
var firstController = ((UIApplicationDelegate)(UIApplication.SharedApplication.Delegate)).Window.RootViewController.ChildViewControllers[0].ChildViewControllers[1].ChildViewControllers[0];
var navcontroller = firstController as UINavigationController;
var docIC = UIDocumentInteractionController.FromUrl(new NSUrl(filePath, true));
docIC.Delegate = new DocInteractionC(navcontroller);
docIC.PresentPreview(true);
}
は、今私はUWP方法openImage()
を作成したいが、私は知っているか分かりません。 StorageFileだけが私に画像を開く許可を与えるので、パスの代わりにStorageFile
というイメージで作業しなければならない可能性が高いことは分かっています。
UWPでフルサイズの画像を開く方法はありますか?私はこのために新しいビューを作成しないことを強く望んでいます。ファイルをローカルフォルダにあるので、私はfilePath
を使用することを働いている私の状況については
public async void openImageAsync(string filePath)
{
StorageFile storageFile = await StorageFile.GetFileFromPathAsync(filePath);
await Launcher.LaunchFileAsync(storageFile);
}
: