|
1 | 1 | @using System.ComponentModel |
2 | 2 | @using Humanizer |
3 | 3 | @inject MessageLog messageLog |
4 | | -@inject GameWatcher eft |
| 4 | +@inject LocalizationService LocalizationService |
5 | 5 |
|
6 | 6 | <MudDialog> |
7 | 7 | <DialogContent> |
8 | 8 | <MudText> |
9 | | - Current profile: @GameWatcher.CurrentProfile.Id (@GameWatcher.CurrentProfile.Type) |
| 9 | + @LocalizationService.GetString("CurrentProfile"): @GameWatcher.CurrentProfile.Id (@GameWatcher.CurrentProfile.Type) |
10 | 10 | </MudText> |
11 | 11 | <MudText> |
12 | | - If you want to update progress for a different profile, activate that profile in the game. |
| 12 | + @LocalizationService.GetString("IfYouWantToUpdateProgressForDifferentProfile") |
13 | 13 | </MudText> |
14 | 14 | @if (customWatcher.LogsPath != "") |
15 | 15 | { |
16 | 16 | if (breakpoints != null) |
17 | 17 | { |
18 | | - <MudSelect @bind-Value="selectedBreakpoint" Label="Read previous logs" HelperText="Choose the starting point from which to read logs" OpenIcon="@Icons.Material.Filled.TextSnippet" AdornmentColor="Color.Secondary"> |
| 18 | + <MudSelect @bind-Value="selectedBreakpoint" Label="@LocalizationService.GetString("ReadPreviousLogsLabel")" HelperText="@LocalizationService.GetString("ChooseStartingPointHelperText")" OpenIcon="@Icons.Material.Filled.TextSnippet" AdornmentColor="Color.Secondary"> |
19 | 19 | @foreach (LogDetails breakpoint in breakpoints) |
20 | 20 | { |
21 | 21 | <MudSelectItem Value="@breakpoint">@breakpoint.Version | @breakpoint.Date.ToLongDateString() - @breakpoint.Date.Humanize()</MudSelectItem> |
22 | 22 | } |
23 | 23 | </MudSelect> |
24 | | - <p>Select a starting point to read previous logs and update your quest progress. All logs from that point forward for the same will be read and that cumulative progress will be synced to Tarkov Tracker.</p> |
25 | | - <p><strong>WARNING: </strong>You can mess up your Tarkov Tracker saved quest progress if you pick an invalid starting date, so proceed with caution.</p> |
| 24 | + <p>@LocalizationService.GetString("SelectStartingPointDescription")</p> |
| 25 | + <p><strong>@LocalizationService.GetString("WarningMessage")</strong></p> |
26 | 26 | } |
27 | 27 | else |
28 | 28 | { |
|
32 | 32 | } |
33 | 33 | else |
34 | 34 | { |
35 | | - <span>Could not find the Escape From Tarkov installation location, or no logs exist.</span> |
| 35 | + <span>@LocalizationService.GetString("CouldNotFindEFTInstallation")</span> |
36 | 36 | } |
37 | 37 | </DialogContent> |
38 | 38 | <DialogActions> |
39 | | - <MudButton OnClick="Cancel">Cancel</MudButton> |
40 | | - <MudButton Color="Color.Primary" OnClick="Submit">Ok</MudButton> |
| 39 | + <MudButton OnClick="Cancel">@LocalizationService.GetString("Cancel")</MudButton> |
| 40 | + <MudButton Color="Color.Primary" OnClick="Submit" Disabled="@SubmitDisabled">@LocalizationService.GetString("Ok")</MudButton> |
41 | 41 | </DialogActions> |
42 | 42 | </MudDialog> |
43 | 43 | @code { |
44 | 44 | [CascadingParameter] MudDialogInstance MudDialog { get; set; } |
45 | 45 |
|
46 | 46 | internal GameWatcher customWatcher = new(); |
47 | | - LogDetails? selectedBreakpoint; |
| 47 | + LogDetails? _selectedBreakpoint; |
| 48 | + LogDetails? selectedBreakpoint { |
| 49 | + get |
| 50 | + { |
| 51 | + return _selectedBreakpoint; |
| 52 | + } |
| 53 | + set |
| 54 | + { |
| 55 | + SubmitDisabled = value == null; |
| 56 | + _selectedBreakpoint = value; |
| 57 | + } |
| 58 | + } |
48 | 59 | List<LogDetails>? breakpoints; |
49 | 60 | Dictionary<string, TarkovMonitor.TaskStatus> TaskStatuses = new(); |
| 61 | + bool SubmitDisabled { get; set; } = true; |
50 | 62 |
|
51 | 63 | protected override void OnInitialized() |
52 | 64 | { |
|
82 | 94 | { |
83 | 95 | messageLog.AddMessage("You must have a valid Tarkov Tracker API token to read past logs.", "exception"); |
84 | 96 | } |
| 97 | + SubmitDisabled = true; |
| 98 | + GameWatcher.ReadingPastLogs = true; |
85 | 99 | TaskStatuses.Clear(); |
86 | 100 | Dictionary<string, TarkovMonitor.TaskStatus> updateTasks = new(); |
87 | 101 | try |
|
128 | 142 | } |
129 | 143 | catch (Exception ex) |
130 | 144 | { |
131 | | - messageLog.AddMessage($"Error finding task updates: {ex.Message}", "exception"); |
| 145 | + messageLog.AddMessage($"Error compiling task updates: {ex.Message}", "exception"); |
132 | 146 | return; |
133 | 147 | } |
| 148 | + finally |
| 149 | + { |
| 150 | + GameWatcher.ReadingPastLogs = false; |
| 151 | + } |
134 | 152 | try |
135 | 153 | { |
136 | 154 | if (updateTasks.Count > 0) |
|
0 commit comments