Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using toast for Player Detail page #129

Merged
merged 1 commit into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions Strings.Designer.cs

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

39 changes: 39 additions & 0 deletions Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -579,4 +579,43 @@
<data name="String1" xml:space="preserve">
<value />
</data>
<data name="Cancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="Error" xml:space="preserve">
<value>Error</value>
</data>
<data name="OK" xml:space="preserve">
<value>OK</value>
</data>
<data name="PlayerDetailPage_AddFavorite" xml:space="preserve">
<value>This player has been added to your favorites</value>
</data>
<data name="PlayerDetailPage_AlreadyConfigured" xml:space="preserve">
<value>You have already configured your Stats page, do you wish to change your Stats to this player?</value>
</data>
<data name="PlayerDetailPage_Caution" xml:space="preserve">
<value>Caution</value>
</data>
<data name="PlayerDetailPage_ConfiguredStats" xml:space="preserve">
<value>You have now configured your Stats page!</value>
</data>
<data name="PlayerDetailPage_ConfigureYourStats" xml:space="preserve">
<value>Configure your Stats</value>
</data>
<data name="PlayerDetailPage_Congratulations" xml:space="preserve">
<value>Congratulations</value>
</data>
<data name="PlayerDetailPage_ErrorMyStats" xml:space="preserve">
<value>There was an error trying to select this player as your 'My Stats' player.</value>
</data>
<data name="PlayerDetailPage_HaventConfiguredMyStats" xml:space="preserve">
<value>Looks like you haven't configured your 'My Stats' page. Use the Player Search to find your Player, and press the Star to configure your Stats</value>
</data>
<data name="PlayerDetailPage_RemoveFavorite" xml:space="preserve">
<value>This player has been removed from your favorites</value>
</data>
<data name="PlayerDetailPage_SharePlayer" xml:space="preserve">
<value>Share Player</value>
</data>
</root>
2 changes: 1 addition & 1 deletion ViewModels/CalendarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task ExecuteLoadItemsCommand(string address, int distance)
{
var sw = Stopwatch.StartNew();
CalendarDetails.Clear();
//InlineCalendarItems.Clear();
Pins.Clear();

logger.LogDebug("Cleared collections in {0}", sw.ElapsedMilliseconds);

Expand Down
14 changes: 9 additions & 5 deletions Views/CalendarPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Serilog.Core;
using Serilog;
using MauiIcons.Core;
using Microsoft.Extensions.Logging;

namespace Ifpa.Views
{
Expand All @@ -25,10 +26,14 @@ public partial class CalendarPage : ContentPage

public CalendarPageView View { get; set; }

public CalendarPage(CalendarViewModel viewModel)
private readonly ILogger<CalendarPage> logger;

public CalendarPage(CalendarViewModel viewModel, ILogger<CalendarPage> logger)
{
InitializeComponent();

this.logger = logger;

BindingContext = ViewModel = viewModel;
viewModel.IsBusy = true;
}
Expand Down Expand Up @@ -70,8 +75,7 @@ private async Task UpdateCalendarData()
catch (Exception e)
{
//don't let the calendar crash our entire app
//TODO: dependency inject this?
Log.Logger.Error(e, "Error loading calendar data");
logger.LogError(e, "Error loading calendar data");
}
}

Expand All @@ -85,14 +89,14 @@ private void ToggleView_Clicked(object sender, EventArgs e)
MapLayout.IsVisible = true;
calendar.IsVisible = false;
View = CalendarPageView.MapAndList;
ToolbarItems.SingleOrDefault(n => n.Text == "Toggle View").IconImageSource = (FontImageSource)new MauiIcon() { Icon = FluentIcons.CalendarLtr28, IconColor = toolbarIconColor };
ToolbarItems.SingleOrDefault(n => n.Text == Strings.CalendarPage_ToggleView).IconImageSource = (FontImageSource)new MauiIcon() { Icon = FluentIcons.CalendarLtr28, IconColor = toolbarIconColor };
}
else
{
MapLayout.IsVisible = false;
calendar.IsVisible = true;
View = CalendarPageView.Calendar;
ToolbarItems.SingleOrDefault(n => n.Text == "Toggle View").IconImageSource = (FontImageSource)new MauiIcon() { Icon = FluentIcons.Map24, IconColor = toolbarIconColor };
ToolbarItems.SingleOrDefault(n => n.Text == Strings.CalendarPage_ToggleView).IconImageSource = (FontImageSource)new MauiIcon() { Icon = FluentIcons.Map24, IconColor = toolbarIconColor };
}
}

Expand Down
Loading
Loading