private async void ClearCacheExecute() { IsLoading = true; TaskCompleted = false; await Task.Run(() => { NativeUtils.CleanDirectory(FileUtils.GetTempFileName(string.Empty), 0); }); IsLoading = false; UpdateCacheSize(resetInitialCacheSize: true, updateDetailedCacheSizes: true); TaskCompleted = true; }
public void Run(IBackgroundTaskInstance taskInstance) { var deferral = taskInstance.GetDeferral(); var mode = 0; if (ApplicationData.Current.LocalSettings.Values.ContainsKey("ClearCacheMode")) { mode = (int)ApplicationData.Current.LocalSettings.Values["ClearCacheMode"]; } if (mode == 0) { deferral.Complete(); return; } NativeUtils.CleanDirectory(FileUtils.GetTempFileName(string.Empty), mode); deferral.Complete(); }