Skip to content

Commit

Permalink
Add button to restart automatically upon language change
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauriethefish committed Jul 1, 2024
1 parent 74d0073 commit 20ab0e1
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
9 changes: 9 additions & 0 deletions QuestPatcher/QuestPatcher.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
<ItemGroup>
<EmbeddedResource Update="Resources\Strings.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
</Project>
12 changes: 11 additions & 1 deletion QuestPatcher/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion QuestPatcher/Services/QuestPatcherUiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private Window PrepareUi()
new ManageModsViewModel(ModManager, InstallManager, window, _operationLocker, progressViewModel, _browseManager),
_loggingViewModel,
new ToolsViewModel(Config, progressViewModel, _operationLocker, window, SpecialFolders, InstallManager, DebugBridge, this, InfoDumper,
_themeManager),
_themeManager, ExitApplication),
_otherItemsView,
Config,
InstallManager,
Expand Down
19 changes: 17 additions & 2 deletions QuestPatcher/ViewModels/ToolsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using QuestPatcher.Core;
using QuestPatcher.Core.Models;
Expand Down Expand Up @@ -46,8 +47,9 @@ public Language SelectedLanguage
private readonly AndroidDebugBridge _debugBridge;
private readonly QuestPatcherUiService _uiService;
private readonly InfoDumper _dumper;
private readonly Action _quit;

public ToolsViewModel(Config config, ProgressViewModel progressView, OperationLocker locker, Window mainWindow, SpecialFolders specialFolders, InstallManager installManager, AndroidDebugBridge debugBridge, QuestPatcherUiService uiService, InfoDumper dumper, ThemeManager themeManager)
public ToolsViewModel(Config config, ProgressViewModel progressView, OperationLocker locker, Window mainWindow, SpecialFolders specialFolders, InstallManager installManager, AndroidDebugBridge debugBridge, QuestPatcherUiService uiService, InfoDumper dumper, ThemeManager themeManager, Action quit)
{
Config = config;
ProgressView = progressView;
Expand All @@ -60,6 +62,7 @@ public ToolsViewModel(Config config, ProgressViewModel progressView, OperationLo
_debugBridge = debugBridge;
_uiService = uiService;
_dumper = dumper;
_quit = quit;

_debugBridge.StoppedLogging += (_, _) =>
{
Expand Down Expand Up @@ -253,8 +256,20 @@ private async void ShowLanguageChangeDialog()
{
Title = Strings.Tools_Option_Language_Title,
Text = Strings.Tools_Option_Language_Text,
HideCancelButton = true
};
builder.OkButton.Text = Strings.Generic_OK;
builder.CancelButton.Text = Strings.Generic_NotNow;
builder.OkButton.OnClick = () =>
{
string? exePath = Process.GetCurrentProcess().MainModule?.FileName;
if(exePath != null)
{
Process.Start(exePath);
}

_quit();
};


await builder.OpenDialogue(_mainWindow);
}
Expand Down

0 comments on commit 20ab0e1

Please sign in to comment.