Ejemplo n.º 1
0
        public async void ClearAppCache()
        {
            // Create a message dialog
            var dialog = new ContentDialog
            {
                Title = "Clear Application Cache?",
                Content = new TextBlock { Text = "Warning: Clearing Application cache will delete the following things:\n• Cached Images.\n• Jumplist Items.\n• Pinned Live Tiles.\n• Notifications.\n\n To Continue press 'Clear Cache', this may take a while.", TextWrapping = TextWrapping.Wrap },
                PrimaryButtonText = "Clear Cache",
                SecondaryButtonText = "Cancel",
                IsPrimaryButtonEnabled = true,
                IsSecondaryButtonEnabled = true
            };

            var response = await dialog.ShowAsync();

            if (response != ContentDialogResult.Primary)
            {
                return;
            }

            // Clear all jumplist items
            await JumplistHelper.RemoveAllAsync();
            // Clear all the live tiles
            await TileService.Current.RemoveAllAsync();
            // Remove all cached images from the app
            var rootCacheFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("cache", CreationCollisionOption.OpenIfExists);
            await rootCacheFolder.DeleteAsync();
            // Remove all toast notifications
            ToastNotificationManager.History.Clear();
        }
Ejemplo n.º 2
0
        public async Task ProvisionAsync()
        {
            var jumplistHelper = new JumplistHelper();

            if (JumplistHelper.IsJumplistPresent)
            {
                await jumplistHelper.ProvisionJumplistAsync();
            }
        }