Skip to content

Commit f5d3b6a

Browse files
committed
added open log button to settings
1 parent 644efd2 commit f5d3b6a

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/Avalonia.Desktop/Pages/SettingsPage.axaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,12 @@
452452
Skip startup window
453453
</CheckBox>
454454

455+
<Button VerticalAlignment="Center"
456+
Command="{Binding OpenLogCommand}"
457+
Margin="10">
458+
Open log...
459+
</Button>
460+
455461
</StackPanel>
456462

457463
</Grid>

src/Avalonia.Desktop/ViewModels/SettingsViewModel.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Avalonia.Platform.Storage;
33
using Avalonia.Styling;
44
using Common.Client.Enums;
5+
using Common.Client.Helpers;
56
using Common.Client.Interfaces;
67
using Common.Common.Helpers;
78
using Common.Enums;
@@ -10,6 +11,7 @@
1011
using CommunityToolkit.Mvvm.ComponentModel;
1112
using CommunityToolkit.Mvvm.Input;
1213
using Games.Providers;
14+
using System.Diagnostics;
1315

1416
namespace Avalonia.Desktop.ViewModels;
1517

@@ -454,5 +456,22 @@ private async Task OpenFilePickerAsync()
454456
OnPropertyChanged(nameof(PathToDuke64));
455457
}
456458

459+
460+
/// <summary>
461+
/// Open log file
462+
/// </summary>
463+
[RelayCommand]
464+
private void OpenLog()
465+
{
466+
if (File.Exists(ClientProperties.PathToLogFile))
467+
{
468+
using var _ = Process.Start(new ProcessStartInfo
469+
{
470+
FileName = ClientProperties.PathToLogFile,
471+
UseShellExecute = true
472+
});
473+
}
474+
}
475+
457476
#endregion
458477
}

0 commit comments

Comments
 (0)