private async void Load() { SampleController.Current.RegisterNewCommand("Image with placeholder", (sender, args) => { AddImage(false, true); }); SampleController.Current.RegisterNewCommand("Image with placeholder (invalid link or offline)", (sender, args) => { AddImage(true, true); }); SampleController.Current.RegisterNewCommand("Image without placeholder", (sender, args) => { AddImage(false, false); }); SampleController.Current.RegisterNewCommand("Round Image with placeholder", (sender, args) => { AddImage(false, true, true); }); SampleController.Current.RegisterNewCommand("Round Image with placeholder (invalid link or offline)", (sender, args) => { AddImage(true, true, true); }); SampleController.Current.RegisterNewCommand("Round Image without placeholder", (sender, args) => { AddImage(false, false, true); }); SampleController.Current.RegisterNewCommand("Lazy loading sample", (sender, args) => { var imageExLazyLoadingControl = new ImageExLazyLoadingControl(); imageExLazyLoadingControl.CloseButtonClick += (s, a) => { if (lazyLoadingControlHost != null) { lazyLoadingControlHost.Child = null; } }; if (lazyLoadingControlHost != null) { lazyLoadingControlHost.Child = imageExLazyLoadingControl; } }); SampleController.Current.RegisterNewCommand("Clear image cache", async(sender, args) => { container?.Children?.Clear(); GC.Collect(); // Force GC to free file locks await ImageCache.Instance.ClearAsync(); }); await LoadDataAsync(); }
private async void Load() { SampleController.Current.RegisterNewCommand("Image with placeholder", (sender, args) => { AddImage(false, true); }); SampleController.Current.RegisterNewCommand("Image with placeholder (invalid link or offline)", (sender, args) => { AddImage(true, true); }); SampleController.Current.RegisterNewCommand("Image without placeholder", (sender, args) => { AddImage(false, false); }); SampleController.Current.RegisterNewCommand("Round Image with placeholder", (sender, args) => { AddImage(false, true, true); }); SampleController.Current.RegisterNewCommand("Round Image with placeholder (invalid link or offline)", (sender, args) => { AddImage(true, true, true); }); SampleController.Current.RegisterNewCommand("Round Image without placeholder", (sender, args) => { AddImage(false, false, true); }); SampleController.Current.RegisterNewCommand("Lazy loading sample", (sender, args) => { var imageExLazyLoadingControl = new ImageExLazyLoadingControl(); imageExLazyLoadingControl.CloseButtonClick += (s, a) => { if (lazyLoadingControlHost != null) { lazyLoadingControlHost.Child = null; } }; if (lazyLoadingControlHost != null) { // Allow this to act as a toggle. if (lazyLoadingControlHost.Child == null) { lazyLoadingControlHost.Child = imageExLazyLoadingControl; } else { lazyLoadingControlHost.Child = null; } } }); SampleController.Current.RegisterNewCommand("Remove images", (sender, args) => container?.Children?.Clear()); await LoadDataAsync(); }