当前位置: 首页>>代码示例>>C#>>正文


C# IFolder.CreateFileAsync方法代码示例

本文整理汇总了C#中IFolder.CreateFileAsync方法的典型用法代码示例。如果您正苦于以下问题:C# IFolder.CreateFileAsync方法的具体用法?C# IFolder.CreateFileAsync怎么用?C# IFolder.CreateFileAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFolder的用法示例。


在下文中一共展示了IFolder.CreateFileAsync方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DownloadFileAsync

 public static async Task<bool> DownloadFileAsync(IFolder folder, string url, string fileName)
 {
     using (var client = new HttpClient())
     using (var response = await client.GetAsync(url))
     {
         if (response.StatusCode == System.Net.HttpStatusCode.OK)
         {
             Stream temp = await response.Content.ReadAsStreamAsync();
             IFile file = await folder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting);
             using (var fs = await file.OpenAsync(PCLStorage.FileAccess.ReadAndWrite))
             {
                 await temp.CopyToAsync(fs);
                 fs.Close();
                 return true;
             }
         }
         else
         {
             Debug.WriteLine("NOT FOUND " + url);
             return false;
         }
     }
 }
开发者ID:garymedina,项目名称:OfflineSyncApp,代码行数:23,代码来源:BlobTransfer.cs

示例2: createFileSystem

        public async void createFileSystem(IFolder fileSystem)
        {
            var loc = await App.dbWrapper.GetLocation();
            var cloudList = await App.dbWrapper.GetAvailableClouds(loc[0], loc[1]);
            string cloudNamesString = "";
            for(int i =0; i<cloudList.Count; i++)
            {
                cloudNamesString +=(cloudList[i].Title) + ",";
                System.Diagnostics.Debug.WriteLine(cloudList[i].Title);

            }
            IFile file = await fileSystem.CreateFileAsync("PhoneData.txt", CreationCollisionOption.ReplaceExisting);
            string baseString = "a\nUVA,"+cloudNamesString+"\n";   ///GOTO: settings page if this is modified
            await file.WriteAllTextAsync(baseString);
            var navPage = new NavigationPage(new CarouselTutorialPage());
            MainPage = navPage;
        }
开发者ID:bpeck81,项目名称:Cloudclub_v1,代码行数:17,代码来源:App.cs

示例3: createCleanFileSystem

        public async void createCleanFileSystem(IFolder fileSystem)
        {

            IFile file = await fileSystem.CreateFileAsync("PhoneData.txt", CreationCollisionOption.ReplaceExisting);
            string baseString = "a\nUVA,\n";   ///GOTO: settings page if this is modified
            await file.WriteAllTextAsync(baseString);
            var navPage = new NavigationPage(new CarouselTutorialPage());
            MainPage = navPage;
        }
开发者ID:bpeck81,项目名称:Cloudclub_v1,代码行数:9,代码来源:App.cs

示例4: CreateFileAsync

        public static async Task<IFile> CreateFileAsync(string path, IFolder folder,
            CreationCollisionOption option = CreationCollisionOption.OpenIfExists)
        {
            if (path.StartsWith("/") || path.StartsWith("\\"))
                path = path.Substring(1);
            var parts = path.Split('/');

            var fileName = parts.Last();

            if (parts.Length > 1)
            {
                folder =
                    await
                        EnsureFolderExistsAsync(path.Substring(0, path.Length - fileName.Length), folder)
                            .DontMarshall();
            }

            return await folder.CreateFileAsync(fileName, option).DontMarshall();
        }
开发者ID:haroldma,项目名称:Audiotica,代码行数:19,代码来源:PclStorageHelper.cs


注:本文中的IFolder.CreateFileAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。