UserProfilePersonalizationSettings.TrySetWallpaperImageAsync 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 이미지 파일을 바탕 화면 배경 화면 이미지로 설정하려고 시도합니다.
public:
virtual IAsyncOperation<bool> ^ TrySetWallpaperImageAsync(StorageFile ^ imageFile) = TrySetWallpaperImageAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<bool> TrySetWallpaperImageAsync(StorageFile const& imageFile);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<bool> TrySetWallpaperImageAsync(StorageFile imageFile);
function trySetWallpaperImageAsync(imageFile)
Public Function TrySetWallpaperImageAsync (imageFile As StorageFile) As IAsyncOperation(Of Boolean)
매개 변수
- imageFile
- StorageFile
바탕 화면 배경으로 설정할 이미지입니다.
반환
비동기 작업의 결과입니다. 배경 이미지가 성공적으로 설정되었으면 true입니다. 그렇지 않으면 false입니다.
- 특성
예제
using Windows.System.UserProfile;
// Pass in a relative path to a file inside the local appdata folder
async Task<bool> SetWallpaperAsync(string localAppDataFileName)
{
bool success = false;
if (UserProfilePersonalizationSettings.IsSupported())
{
var uri = new Uri("ms-appx:///Local/" + localAppDataFileName);
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(uri);
UserProfilePersonalizationSettings profileSettings = UserProfilePersonalizationSettings.Current;
success = await profileSettings.TrySetWallpaperImageAsync(file);
}
}
설명
참고
이미지를 두 번 이상 설정하면 새 이미지 파일의 이름이 이전에 설정한 이미지와 달라야 합니다. 이전 이미지와 이름이 같은 파일을 사용하여 새 이미지를 설정하면 실패합니다.