Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Heufneutje committed Nov 14, 2024
1 parent fa04be6 commit 8c0a2f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
9 changes: 7 additions & 2 deletions SpeedrunTracker/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace SpeedrunTracker;

namespace SpeedrunTracker;

public partial class App : Application
{
Expand All @@ -8,6 +9,10 @@ public App(ILocalSettingsService settingsService)
{
InitializeComponent();
UserAppTheme = settingsService.UserSettings.Theme;
MainPage = new AppShell();
}

protected override Window CreateWindow(IActivationState activationState)
{
return new Window(new AppShell());
}
}
10 changes: 7 additions & 3 deletions SpeedrunTracker/Services/DialogService.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
namespace SpeedrunTracker.Services;
using Microsoft.Maui.Controls.PlatformConfiguration;

namespace SpeedrunTracker.Services;

public class DialogService : IDialogService
{
public Task ShowAlertAsync(string title, string message, string cancel = "OK")
{
return Application.Current.MainPage.DisplayAlert(title, message, cancel);
return GetMainPage()?.DisplayAlert(title, message, cancel);
}

public Task<bool> ShowConfirmationAsync(string title, string message, string accept = "Yes", string cancel = "No")
{
return Application.Current.MainPage.DisplayAlert(title, message, accept, cancel);
return GetMainPage()?.DisplayAlert(title, message, accept, cancel);
}

private Page GetMainPage() => Application.Current.Windows[0].Page;
}

0 comments on commit 8c0a2f9

Please sign in to comment.