Skip to content

Commit

Permalink
Unsubscribe from Loaded event in BasemapGallery
Browse files Browse the repository at this point in the history
  • Loading branch information
prathameshnarkhede committed Jun 12, 2024
1 parent 7d2de14 commit 4f0fa2d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Toolkit/Toolkit.Maui/BasemapGallery/BasemapGallery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public BasemapGallery()

private async void BasemapGallery_Loaded(object? sender, EventArgs e)
{
// Unsubscribe from the Loaded event to ensure this only runs once.
Loaded -= BasemapGallery_Loaded;

if (AvailableBasemaps is null)
{
_loadCancellationTokenSource = new CancellationTokenSource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public BasemapGallery()

private async void BasemapGallery_Loaded(object? sender, RoutedEventArgs e)
{
// Unsubscribe from the Loaded event to ensure this only runs once.
Loaded -= BasemapGallery_Loaded;

if (AvailableBasemaps is null)
{
_loadCancellationTokenSource = new CancellationTokenSource();
Expand Down

0 comments on commit 4f0fa2d

Please sign in to comment.