Example #1
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            Shell.Current.RegisterNewCommand("Image with placeholder", (sender, args) =>
            {
                AddImage(false, true);
            });

            Shell.Current.RegisterNewCommand("Image with placeholder (invalid link or offline)", (sender, args) =>
            {
                AddImage(true, true);
            });

            Shell.Current.RegisterNewCommand("Image without placeholder", (sender, args) =>
            {
                AddImage(false, false);
            });

            Shell.Current.RegisterNewCommand("Clear image cache", async(sender, args) =>
            {
                Container.Children.Clear();
                GC.Collect(); // Force GC to free file locks
                await ImageCache.ClearAsync();
            });

            await LoadDataAsync();

            AddImage(false, true);
        }
        private async void ClearImageCache(object sender, RoutedEventArgs e)
        {
            BtnClearImageCache.IsEnabled = false;
            await ImageCache.ClearAsync();

            BtnClearImageCache.IsEnabled = true;
        }