From 92aa9ca10e8ed47742d887c6fb7188fda2159a49 Mon Sep 17 00:00:00 2001 From: Sleevezipper Date: Sat, 16 Oct 2021 23:05:51 +0200 Subject: [PATCH] add buttons to open logs and config --- UserInterface/Views/AppInfo.axaml | 8 ++++++++ UserInterface/Views/AppInfo.axaml.cs | 18 ++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/UserInterface/Views/AppInfo.axaml b/UserInterface/Views/AppInfo.axaml index afab0c5..87a9324 100644 --- a/UserInterface/Views/AppInfo.axaml +++ b/UserInterface/Views/AppInfo.axaml @@ -13,6 +13,14 @@ + +Having issues? Check out the log files. +Using the configuration files is recommended +for advanced users only. + + + + diff --git a/UserInterface/Views/AppInfo.axaml.cs b/UserInterface/Views/AppInfo.axaml.cs index ed0b184..20df1be 100644 --- a/UserInterface/Views/AppInfo.axaml.cs +++ b/UserInterface/Views/AppInfo.axaml.cs @@ -11,13 +11,16 @@ using UserInterface.ViewModels; using System.Security; using hass_workstation_service.Communication.InterProcesCommunication.Models; using UserInterface.Util; +using System; +using System.IO; +using System.Diagnostics; namespace UserInterface.Views { public class AppInfo : UserControl { private readonly IIpcClient client; - + private readonly string _basePath; public AppInfo() { this.InitializeComponent(); @@ -32,7 +35,7 @@ namespace UserInterface.Views // create client this.client = clientFactory.CreateClient("info"); - + this._basePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Hass Workstation Service"); @@ -63,6 +66,17 @@ namespace UserInterface.Views BrowserUtil.OpenBrowser("https://discord.gg/VraYT2N3wd"); } + public void OpenLogDirectory(object sender, RoutedEventArgs args) + { + string path = Path.Combine(this._basePath, "logs"); + Process.Start("explorer.exe", path); + } + + public void OpenConfigDirectory(object sender, RoutedEventArgs args) + { + Process.Start("explorer.exe", this._basePath); + } + private void InitializeComponent() { AvaloniaXamlLoader.Load(this);