![](/img/trans.png)
[英]How can I open a file I've added to my Windows Store App project programatically?
[英]File “Open with” my Windows Store App
我希望Windows Store App
可以通過Windows資源管理器的“右鍵單擊/打開方式”命令來處理打開的txt文件。
我的應用程序完美地顯示在要使用的可用應用程序列表中,我可以單擊它,但是我不知道應該注冊哪個事件以獲取文件名和內容。
任何想法?
在MSDN上查看此文章如何處理文件激活
您需要處理OnFileActivated事件
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
}
在應用程序包中添加適當的圖標
在C#中,您需要處理OnFileActivated事件
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
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.