当我在文件资源管理器中双击一个.txt文件时,会启动记事本,并在那里自动打开该文件.我希望能够使用.NET Maui应用程序重新创建这种行为-我希望我的应用程序在我双击具有特定扩展名的文件时启动,我希望我的应用程序自动打开该文件,以便我可以立即开始使用它,就像处理记事本和.txt文件一样.
我试着在.NET Maui文档和Stack Overflow上四处寻找,但我能得到的最接近的结果是手动打开一个已经在运行的应用程序的文件.
The question here mentions setting the app as default on Windows but this fact is stated as a given, while I don't know how I could go about doing this. Furthermore, if it really is necessary to set something in the system settings, I would like to make it so that my app's installer would take care of it. How can I do that? Here's the question I mentioned:
How to use my app to open a file when I double-click it?
The question here says something about command line arguments, but it doesn't answer the question of how a file can be opened by double-clicking, and it also talks about frameworks other than .NET MAUI:
How can I open a file in my WPF app, when the user double-clicks on that file?