Windows フォト ビューアーに似たメトロ スタイルのアプリを作成したいと考えています。
そのためには、Openwith コンテキスト メニューにアプリを追加する必要があります。また、Windows エクスプローラーで選択した画像ファイルは、フォト ビューアーで開く必要があります。選択した画像ファイルをパラメーターとしてアプリを開く方法は?
前もって感謝します
どうもありがとう@フィリップ
に次のコードを書きましOnFileActivated(FileActivatedEventArgs args)
たApp.xaml.cs
protected override void OnFileActivated(FileActivatedEventArgs args)
{
// TODO: Handle file activation
// The number of files received is args.Files.Size
// The first file is args.Files[0].Name
base.OnFileActivated(args);
StorageFile file = args.Files[0] as StorageFile;
Frame rootFrame = Window.Current.Content as Frame;
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
//rootFrame.SourcePageType = typeof(ImageViewer);
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
if (!rootFrame.Navigate(typeof(ImageViewer), file))
{
throw new Exception("Failed to create initial page");
}
}
// Ensure the current window is active
Window.Current.Activate();
}
しかし、私のアプリは開いても何も表示されません。それで、あなたによると、何が欠陥になる可能性がありますか?