當前位置: 首頁>>代碼示例>>C#>>正文


C# StorageFile.MoveAsync方法代碼示例

本文整理匯總了C#中Windows.Storage.StorageFile.MoveAsync方法的典型用法代碼示例。如果您正苦於以下問題:C# StorageFile.MoveAsync方法的具體用法?C# StorageFile.MoveAsync怎麽用?C# StorageFile.MoveAsync使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Windows.Storage.StorageFile的用法示例。


在下文中一共展示了StorageFile.MoveAsync方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MoveFileAsync

        public async Task MoveFileAsync(StorageFile file, StorageFolder destinationFolder, string desiredNewFileName)
        {
            if (Exist(destinationFolder, desiredNewFileName))
            {
                try
                {
                    StorageFile fileToDelete = await destinationFolder.GetFileAsync(desiredNewFileName);
                    await DeleteAsync(fileToDelete);

                }
                catch (Exception)
                {
                    //TODO there is a known issue of the .net api; fix this when the api will be fixed
                }
            }

            await file.MoveAsync(destinationFolder,desiredNewFileName);
        }
開發者ID:stonemonkey,項目名稱:WhereAmI,代碼行數:18,代碼來源:FileManipulator.cs

示例2: GetPictureFromCameraAsync

        public async Task<string> GetPictureFromCameraAsync()
        {
            var photo = new CameraCaptureUI();

            photo.PhotoSettings.AllowCropping = true;
            photo.PhotoSettings.CroppedAspectRatio = new Size(1, 1);
            photo.PhotoSettings.MaxResolution = CameraCaptureUIMaxPhotoResolution.HighestAvailable;
            photo.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Png;

            _recordStorageFile = await photo.CaptureFileAsync(CameraCaptureUIMode.Photo);

            if (_recordStorageFile != null)
            {
                var path = Path.Combine(StorageService.ImagePath);
                _url = string.Format("Image_{0}.{1}", Guid.NewGuid(), _recordStorageFile.FileType);
                var folder = await StorageFolder.GetFolderFromPathAsync(path);

                await _recordStorageFile.MoveAsync(folder, _url, NameCollisionOption.FailIfExists);

                return string.Format("{0}\\{1}",path, _url);
            }

            return "";
        }
開發者ID:india-rose,項目名稱:xamarin-indiarose,代碼行數:24,代碼來源:MediaService.cs

示例3: MoveFileToLocalAsync

 public static async Task MoveFileToLocalAsync(StorageFile backingFile)
 {
     await backingFile.MoveAsync(_localFolder, backingFile.Name, NameCollisionOption.GenerateUniqueName);
 }        
開發者ID:pingzing,項目名稱:Codeco,代碼行數:4,代碼來源:FileUtilities.cs


注:本文中的Windows.Storage.StorageFile.MoveAsync方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。