Allow opening file location

This commit is contained in:
2026-02-16 19:54:14 +09:00
parent f47200d636
commit 480e2317ad
2 changed files with 40 additions and 1 deletions
+24 -1
View File
@@ -214,7 +214,7 @@ class MainViewModel : BaseViewModel, IFontResolver
MimeTypes = [ "image/heic" ]
},
FilePickerFileTypes.Pdf,
]
],
});
if (files.Count > 0)
{
@@ -260,6 +260,29 @@ class MainViewModel : BaseViewModel, IFontResolver
}
}
public void OpenFile(ReportFile file)
{
var topLevel = TopLevelGrabber?.GetTopLevel();
if (topLevel is not null)
{
Console.WriteLine(file.FilePath);
var launcher = topLevel.Launcher;
launcher.LaunchUriAsync(new Uri(file.FilePath));
}
}
public void OpenFileLocation(ReportFile file)
{
var topLevel = TopLevelGrabber?.GetTopLevel();
var dirName = Path.GetDirectoryName(file.FilePath);
if (topLevel is not null && dirName != null)
{
Console.WriteLine(file.FilePath);
var launcher = topLevel.Launcher;
launcher.LaunchUriAsync(new Uri(dirName));
}
}
public void ResortPDFItemsByDate()
{
LogInfo("Sorting report files list...");