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="Right" Margin="10 10" Click="GitHub">GitHub</Button>
<Button Width="75" HorizontalAlignment="Left" Margin="10 10" Click="Discord">Discord</Button> <Button Width="75" HorizontalAlignment="Left" Margin="10 10" Click="Discord">Discord</Button>
</StackPanel> </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>
</StackPanel> </StackPanel>
</UserControl> </UserControl>

@ -11,13 +11,16 @@ using UserInterface.ViewModels;
using System.Security; using System.Security;
using hass_workstation_service.Communication.InterProcesCommunication.Models; using hass_workstation_service.Communication.InterProcesCommunication.Models;
using UserInterface.Util; using UserInterface.Util;
using System;
using System.IO;
using System.Diagnostics;
namespace UserInterface.Views namespace UserInterface.Views
{ {
public class AppInfo : UserControl public class AppInfo : UserControl
{ {
private readonly IIpcClient<IServiceContractInterfaces> client; private readonly IIpcClient<IServiceContractInterfaces> client;
private readonly string _basePath;
public AppInfo() public AppInfo()
{ {
this.InitializeComponent(); this.InitializeComponent();
@ -32,7 +35,7 @@ namespace UserInterface.Views
// create client // create client
this.client = clientFactory.CreateClient("info"); 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"); 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() private void InitializeComponent()
{ {
AvaloniaXamlLoader.Load(this); AvaloniaXamlLoader.Load(this);

Loading…
Cancel
Save