-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppShell.xaml.cs
45 lines (37 loc) · 1.48 KB
/
AppShell.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#nullable disable
using BigBazar.Views;
using System.Reflection;
namespace BigBazar
{
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
Routing.RegisterRoute("BoxDetail", typeof(BoxPage));
Routing.RegisterRoute("CatSelection", typeof(CatSelectionPage));
Routing.RegisterRoute("FullPhoto", typeof(FullScreenPhotoPage));
Routing.RegisterRoute("detail/Gallery", typeof(GalleryPage));
/* if (DeviceInfo.Platform == DevicePlatform.WinUI)
{
// Verrouillez le flyout pour qu'il reste toujours ouvert sur Windows
this.FlyoutBehavior = FlyoutBehavior.Locked;
}*/
}
// Clear the cache when navigating to a new page
ShellContent previousShellContent;
protected override void OnNavigated(ShellNavigatedEventArgs args)
{
base.OnNavigated(args);
if (CurrentItem?.CurrentItem?.CurrentItem is not null &&
previousShellContent is not null)
{
var property = typeof(ShellContent)
.GetProperty("ContentCache",
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
property?.SetValue(previousShellContent, null);
}
previousShellContent = CurrentItem?.CurrentItem?.CurrentItem;
}
}
}