static StorageService() { var applicationData = ApplicationData.Current; LocalStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.LocalFolder); #if WINDOWS_PHONE if (Version.Parse(Deployment.Current.RuntimeVersion).Major >= 6) { RoamingStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.RoamingFolder); TemporaryStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.TemporaryFolder); var localCacheFolderPropertyInfo = applicationData.GetType().GetRuntimeProperty("LocalCacheFolder"); if (localCacheFolderPropertyInfo != null) { LocalCacheStorageServiceHandlerStatic = new StorageServiceHandler((StorageFolder)localCacheFolderPropertyInfo.GetValue(applicationData)); } } #else RoamingStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.RoamingFolder); TemporaryStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.TemporaryFolder); #endif #if WINDOWS_PHONE_APP var localCacheFolderPropertyInfo = applicationData.GetType().GetRuntimeProperty("LocalCacheFolder"); if (localCacheFolderPropertyInfo != null) { LocalCacheStorageServiceHandlerStatic = new StorageServiceHandler((StorageFolder)localCacheFolderPropertyInfo.GetValue(applicationData)); } #endif }
static StorageService() { var applicationData = ApplicationData.Current; LocalStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.LocalFolder, StorageServiceStorageType.Local); PackageStorageServiceHandlerStatic = new StorageServiceHandler(Windows.ApplicationModel.Package.Current.InstalledLocation, StorageServiceStorageType.Package); #if !WINDOWS_PHONE RoamingStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.RoamingFolder, StorageServiceStorageType.Roaming); TemporaryStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.TemporaryFolder, StorageServiceStorageType.Temporary); #endif #if WINDOWS_PHONE_81 || WINDOWS_PHONE_APP var localCacheFolderPropertyInfo = applicationData.GetType().GetRuntimeProperty("LocalCacheFolder"); if (localCacheFolderPropertyInfo != null) { LocalCacheStorageServiceHandlerStatic = new StorageServiceHandler((StorageFolder)localCacheFolderPropertyInfo.GetValue(applicationData), StorageServiceStorageType.LocalCache); } #endif }