From a7e137306f1021e6b1a7cfa5eaaed9b6a71a23e6 Mon Sep 17 00:00:00 2001 From: Soapwood Date: Sat, 27 Jul 2024 19:54:35 +0100 Subject: [PATCH] Add button to About view to open logs folder for when users are reporting bugs. --- VXMusicDesktop/MVVM/View/AboutView.xaml | 17 +++++++++++++ .../MVVM/ViewModel/AboutViewModel.cs | 25 ++++++++++++++++++- VXMusicDesktop/VXMusicDesktop.csproj | 2 +- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/VXMusicDesktop/MVVM/View/AboutView.xaml b/VXMusicDesktop/MVVM/View/AboutView.xaml index a63e446..3e2d515 100644 --- a/VXMusicDesktop/MVVM/View/AboutView.xaml +++ b/VXMusicDesktop/MVVM/View/AboutView.xaml @@ -168,6 +168,23 @@ VXMusic Open Source Library available on GitHub BRUSHSTRIKE is a brush typeface designed by Francesco Canovaro + + + + + + + + + \ No newline at end of file diff --git a/VXMusicDesktop/MVVM/ViewModel/AboutViewModel.cs b/VXMusicDesktop/MVVM/ViewModel/AboutViewModel.cs index 687e7ed..899a412 100644 --- a/VXMusicDesktop/MVVM/ViewModel/AboutViewModel.cs +++ b/VXMusicDesktop/MVVM/ViewModel/AboutViewModel.cs @@ -9,21 +9,44 @@ using VXMusicDesktop.Core; using System.Windows.Input; using System.ComponentModel; +using System.IO; namespace VXMusicDesktop.MVVM.ViewModel { public class AboutViewModel : INotifyPropertyChanged { + private RelayCommand openFolderClick; + public ICommand OpenFolderCommand => openFolderClick ??= new RelayCommand(OpenFolder); + public event PropertyChangedEventHandler? PropertyChanged; + private static readonly string LogsOutputPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), + "VirtualXtensions", "VXMusic", "Logs"); + public AboutViewModel() { - } protected virtual void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } + + private void OpenFolder(object commandParameter) + { + try + { + Process.Start(new ProcessStartInfo + { + FileName = LogsOutputPath, + UseShellExecute = true, + Verb = "open" + }); + } + catch (Exception ex) + { + MessageBox.Show($"Failed to open Log folder: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error); + } + } } } diff --git a/VXMusicDesktop/VXMusicDesktop.csproj b/VXMusicDesktop/VXMusicDesktop.csproj index b35c1c2..0473cd9 100644 --- a/VXMusicDesktop/VXMusicDesktop.csproj +++ b/VXMusicDesktop/VXMusicDesktop.csproj @@ -9,7 +9,7 @@ VXLogo.png Images\VXLogoIcon.ico Always - 0.6.4.14 + 0.6.4.15 en VXMusicDesktop VirtualXtensions