Skip to content

Commit a06581c

Browse files
committed
Prevent Crash on Rapid Back/Forward Press
1 parent 9a1349a commit a06581c

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

Files UWP/Filesystem/ItemViewModel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,12 @@ public async void AddItemsToCollectionAsync(string path, Page currentPage)
356356
{
357357
if (typeof(PageType) == typeof(GenericFileBrowser))
358358
{
359+
if (_cancellationTokenSource.IsCancellationRequested) { return; }
359360
(tabInstance.accessibleContentFrame.Content as GenericFileBrowser).TextState.isVisible = Visibility.Visible;
360361
}
361362
else if (typeof(PageType) == typeof(PhotoAlbum))
362363
{
364+
if (_cancellationTokenSource.IsCancellationRequested) { return; }
363365
(tabInstance.accessibleContentFrame.Content as PhotoAlbum).TextState.isVisible = Visibility.Visible;
364366
}
365367
}
@@ -399,10 +401,12 @@ public async void AddItemsToCollectionAsync(string path, Page currentPage)
399401

400402
if (typeof(PageType) == typeof(GenericFileBrowser))
401403
{
404+
if (_cancellationTokenSource.IsCancellationRequested) { return; }
402405
(tabInstance.accessibleContentFrame.Content as GenericFileBrowser).progressBar.Visibility = Visibility.Collapsed;
403406
}
404407
else if (typeof(PageType) == typeof(PhotoAlbum))
405408
{
409+
if (_cancellationTokenSource.IsCancellationRequested) { return; }
406410
(tabInstance.accessibleContentFrame.Content as PhotoAlbum).progressBar.Visibility = Visibility.Collapsed;
407411
}
408412
}

Files UWP/ProHome.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ public async void ShowPropertiesButton_Click(object sender, RoutedEventArgs e)
922922
{
923923
propertiesFrame.Navigate(typeof(Properties), (ItemViewModel<ProHome>.GetCurrentSelectedTabInstance<ProHome>().accessibleContentFrame.Content as PhotoAlbum).gv.SelectedItems, new SuppressNavigationTransitionInfo());
924924
}
925-
await PropertiesDialog.ShowAsync();
925+
await PropertiesDialog.ShowAsync(ContentDialogPlacement.Popup);
926926
}
927927

928928
public void PropertiesWindow_CancelButton_Click(object sender, RoutedEventArgs e)

Files UWP/Properties.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
</StackPanel>
5151

5252
<StackPanel Spacing="5" Padding="0,10" Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center">
53-
<Button Content="OK" Foreground="White" Background="#FF0078D7" CornerRadius="2" Width="128" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
53+
<Button Content="OK" Foreground="White" Background="#FF0078D7" CornerRadius="2" Width="128" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Click="Button_Click"/>
5454
<Button Content="Apply" CornerRadius="2" Width="128" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
5555
<Button Content="Cancel" CornerRadius="2" Width="128" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
5656
</StackPanel>

Files UWP/Properties.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,10 @@ private void Apply_Button_Click(object sender, RoutedEventArgs e)
3434
{
3535

3636
}
37+
38+
private void Button_Click(object sender, RoutedEventArgs e)
39+
{
40+
41+
}
3742
}
3843
}

0 commit comments

Comments
 (0)