private void checkVersion() { bool isNeedClean = false; if (WpStorage.GetIsoSetting("Version") != null) { string version = WpStorage.GetIsoSetting("Version").ToString(); if (version != DeviceUtil.GetAppVersion()) { isNeedClean = true; WpStorage.SetIsoSetting("Version", DeviceUtil.GetAppVersion()); } } else { if (IsolatedStorageSettings.ApplicationSettings.Count > 0 || WpStorage.isoFile.DirectoryExists(CommonData.IsoRootPath)) { isNeedClean = true; } WpStorage.SetIsoSetting("Version", DeviceUtil.GetAppVersion()); } if (isNeedClean) { if (MessageBox.Show("检测到版本更新,为避免数据冲突建议清除本地缓存,是否清除缓存?", "", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { WpStorage.DeleteDirectory(CommonData.IsoRootPath); IsolatedStorageSettings.ApplicationSettings.Clear(); WpStorage.SetIsoSetting("Version", DeviceUtil.GetAppVersion()); } } App.BeginApp(); }
private void DeleteAllIcon_Click(object sender, EventArgs e) { if (pvoitIndex == 0) { if (MessageBox.Show("确定要删除所有正在缓存的剧集吗?", "", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { App.DownVideoModel.StopGetVideoData(); foreach (DownVideoInfoViewMoel Video in App.DownVideoModel.DowningVideo) { if (Video.LocalImage != null) { if (WpStorage.isoFile.FileExists(Video.LocalImage)) { WpStorage.isoFile.DeleteFile(Video.LocalImage); } } if (WpStorage.isoFile.FileExists(CommonData.videoSavePath + Video.VideoId.ToString() + ".mp4")) { WpStorage.isoFile.DeleteFile(CommonData.videoSavePath + Video.VideoId.ToString() + ".mp4"); } } App.DownVideoModel.DowningVideo = null; App.DownVideoModel.DowningVideoids = null; App.DownVideoModel.SaveVideoData(); LoadEditIcon(); } } else if (pvoitIndex == 1) { if (MessageBox.Show("确定要删除所有已经缓存的剧集吗?", "", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { App.DownVideoModel.DownedVideo = null; App.DownVideoModel.DownedVideoids = null; WpStorage.DeleteDirectory(CommonData.videoSavePath); App.DownVideoModel.SaveVideoData(); LoadEditIcon(); #if DEBUG long memory = DeviceStatus.ApplicationCurrentMemoryUsage / (1024 * 1024); long memoryLimit = DeviceStatus.ApplicationMemoryUsageLimit / (1024 * 1024); long memoryMax = DeviceStatus.ApplicationPeakMemoryUsage / (1024 * 1024); System.Diagnostics.Debug.WriteLine("当前内存使用情况:" + memory.ToString() + " MB 当前最大内存使用情况: " + memoryMax.ToString() + "MB 当前可分配最大内存: " + memoryLimit.ToString() + " MB"); #endif } } }