small bug fixes
This commit is contained in:
+41
-8
@@ -1,4 +1,5 @@
|
||||
using cfs_tracker.Services;
|
||||
using cfs_tracker.ViewModels;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace cfs_tracker;
|
||||
@@ -7,15 +8,22 @@ public partial class App : Application
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly AppBootstrapService _bootstrapService;
|
||||
private readonly LocalizationService _localizationService;
|
||||
|
||||
private bool _startupTriggered;
|
||||
|
||||
public App(IServiceProvider serviceProvider, AppBootstrapService bootstrapService)
|
||||
public App(
|
||||
IServiceProvider serviceProvider,
|
||||
AppBootstrapService bootstrapService,
|
||||
LocalizationService localizationService)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_serviceProvider = serviceProvider;
|
||||
_bootstrapService = bootstrapService;
|
||||
_localizationService = localizationService;
|
||||
|
||||
_localizationService.Initialize();
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
UserAppTheme = AppTheme.Dark;
|
||||
}
|
||||
@@ -63,7 +71,7 @@ public partial class App : Application
|
||||
{
|
||||
return new ContentPage
|
||||
{
|
||||
Title = "Laden",
|
||||
Title = LocalizationService.Translate("App_Loading_Title"),
|
||||
BackgroundColor = Color.FromArgb("#0B1A2A"),
|
||||
Content = new Grid
|
||||
{
|
||||
@@ -86,7 +94,7 @@ public partial class App : Application
|
||||
},
|
||||
new Label
|
||||
{
|
||||
Text = "App wird geladen ...",
|
||||
Text = LocalizationService.Translate("App_Loading_Message"),
|
||||
FontSize = 20,
|
||||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
TextColor = Color.FromArgb("#DCE7F3")
|
||||
@@ -102,7 +110,7 @@ public partial class App : Application
|
||||
{
|
||||
return new ContentPage
|
||||
{
|
||||
Title = "Startfehler",
|
||||
Title = LocalizationService.Translate("App_Error_Title"),
|
||||
BackgroundColor = Color.FromArgb("#0B1A2A"),
|
||||
Content = new ScrollView
|
||||
{
|
||||
@@ -114,7 +122,7 @@ public partial class App : Application
|
||||
{
|
||||
new Label
|
||||
{
|
||||
Text = "Fehler beim Starten der App",
|
||||
Text = LocalizationService.Translate("App_Error_Header"),
|
||||
FontSize = 24,
|
||||
FontAttributes = FontAttributes.Bold,
|
||||
TextColor = Color.FromArgb("#FFB4B4")
|
||||
@@ -130,4 +138,29 @@ public partial class App : Application
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ReloadShellAsync(string route = "//options", OptionsViewModel.OptionsTab? optionsTab = null)
|
||||
{
|
||||
var shell = _serviceProvider.GetRequiredService<AppShell>();
|
||||
|
||||
await MainThread.InvokeOnMainThreadAsync(async () =>
|
||||
{
|
||||
var window = Windows.FirstOrDefault();
|
||||
if (window is null)
|
||||
return;
|
||||
|
||||
window.Page = shell;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(route))
|
||||
await shell.GoToAsync(route);
|
||||
|
||||
if (optionsTab.HasValue)
|
||||
{
|
||||
await Task.Delay(50);
|
||||
|
||||
if (shell.CurrentPage is Views.OptionsPage optionsPage)
|
||||
optionsPage.ViewModel.SelectedTab = optionsTab.Value;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user