diff --git a/ViewModels/MainViewModel.cs b/ViewModels/MainViewModel.cs index 4924f6a..1ad3a12 100644 --- a/ViewModels/MainViewModel.cs +++ b/ViewModels/MainViewModel.cs @@ -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..."); diff --git a/Views/MainView.axaml b/Views/MainView.axaml index 97a69de..6843c16 100644 --- a/Views/MainView.axaml +++ b/Views/MainView.axaml @@ -115,6 +115,22 @@ : + + + + + :