vanslyker
vanslyker

Reputation: 306

WinRT - how to open file in code and prevent users from trying to open files of the same type with app

In my WinRT app I need to read a specific text file from the users documents folder (I know exactly where the file is because the WinRT app is a companion to software the user has already installed). I can do this with StorageFile/ReadTextAsync and a registered file association type added to the app manifest.

My problem is that since I must declare a File Association in the app manifest, now every time a user opens ANY text file (.txt) Windows 8 alerts them that my WinRT app can open it. This is not ideal because my app is only programmatically reading a specific text file at one place in code - it cannot open ANY text file. Of course if I remove the file association from the manifest then I am unable to read my text file programmatically.

My question is how can I read a text file in code, but not enable users to think my app can open any text file?

Note: There is a checkbox on the file association properties called "Always Unsafe" which you'd think would do what I want, but apparently it does not disable users from being able to open text files with my app.

Upvotes: 1

Views: 615

Answers (1)

VasileF
VasileF

Reputation: 2916

I might have understood your situation wrong, but if within your app the user can chose a file, you can filter what type of files he can open at the picker options.

Upvotes: 0

Related Questions