I have a nice little assignment organizer that I want to add a backup option to. But I don't want it in an ordinary xml file or someother file because of the possibility of file corruption. So how can I make a file extension that the program knows and can save to and open with a .asog file extension?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
You can add a file extension with either a Setup project or a ClickOnce install. Once you have it setup, a user can double click on a .asog file and your app will be invoked with the filename as the first entry in the arguments array of main.
If you want to associate a file with extension (.magi) with your WPF application, i advise you to use InnoSetup to do that.
For example, i I developed an Wpf application called MAGI. We assocaite an icon to ".magi" file and when a user click on a ".magi" file it's launch the application and open it directly in the application.
Use InnoSetup to modifiy the registry easyly
Just add this instructino in your iss file :
Parse the arguments in the "Startup" method
We use the
Startup
property in the main Xaml, in order to call your parser like a usefull main method.And in the code-behind we add this method
Try this:
How does Vista generate the icon for documents associated to my application?
The accepted answer explains icons and file associations.
It doesn't matter that your app uses WPF. The file associations don't care what GUI framework your app uses.