add buttons to open logs and config

burnt-toast
Sleevezipper 3 years ago
parent 68238ef38a
commit 92aa9ca10e

@ -13,6 +13,14 @@
<Button Width="75" HorizontalAlignment="Right" Margin="10 10" Click="GitHub">GitHub</Button>
<Button Width="75" HorizontalAlignment="Left" Margin="10 10" Click="Discord">Discord</Button>
</StackPanel>
<TextBlock Margin="0 0 0 20">
Having issues? Check out the log files.
Using the configuration files is recommended
for advanced users only.</TextBlock >
<StackPanel Margin="0 0 0 20" HorizontalAlignment="Left" Orientation="Horizontal">
<Button Width="75" HorizontalAlignment="Right" Margin="10 10" Click="OpenLogDirectory">Log files</Button>
<Button Width="75" HorizontalAlignment="Left" Margin="10 10" Click="OpenConfigDirectory">Config files</Button>
</StackPanel>
</StackPanel>
</StackPanel>
</UserControl>

@ -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<IServiceContractInterfaces> 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);

Loading…
Cancel
Save