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


C# Setting.SaveAsync方法代码示例

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


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

示例1: LogLocalStorage

        public async Task LogLocalStorage(string path, string name)
        {
            //List<FileUploadCompleted> loglist = new List<FileUploadCompleted>();
            //loglist.Add(new FileUploadCompleted { name = name, uploadedOn = DateTime.Now, url = path });

            //var applicationData = Windows.Storage.ApplicationData.Current;
            //var localSettings = applicationData.LocalSettings;

            //if(localSettings.Values["uploadlog"] !=null)
            //{
            //    List<FileUploadCompleted> localloglist = (List<FileUploadCompleted>)localSettings.Values["uploadlog"]; 
            //}
            //else
            //{
            //    localSettings.Values["uploadlog"] = loglist;
            //}

            var storage = new Setting<List<FileUploadCompleted>>();
            List<FileUploadCompleted> obj = await storage.LoadAsync("uploadlog");

            List<FileUploadCompleted> loglist;
            if(obj!=null)
            {
                if (obj.Where(p => p.Name != name).ToList().Count < 1)
                {
                    loglist = obj;
                    loglist.Add(new FileUploadCompleted { Name = name,  UploadEndtime = DateTime.Now, Url = path });
                    await storage.SaveAsync("uploadlog", loglist);
                }
            }
            else
            {
                loglist = new List<FileUploadCompleted>();
                await storage.SaveAsync("uploadlog", loglist); 
            }

        }
开发者ID:prashanthganathe,项目名称:PersonalProjects,代码行数:37,代码来源:AmazonFileBucketTransferUtil.cs

示例2: InitiateFileUploading

        public async Task InitiateFileUploading()
        {
           // patientList = new List<PatientData>();
            StartTime = DateTime.Now.ToString();
            PatientData PatientDataObj=null;

            var storage = new Setting<List<PatientData>>();           
            IReadOnlyList<StorageFile> files = await GetUploadingFileList();
            var currentUploadCount = new Setting<int>();


            DeletePartiallyUploadedItems();
            int count = 0;
            //var temp = patientList.Select(p => p.Image1.Name).Except(files.Select(x=>x.Name));
             IEnumerable<string> filesTemp;
             if (patientList.Count > 0)
                 filesTemp = files.Select(p => p.Name).Except(patientList.Select(x => x.Image1.Name));
             else
                 filesTemp = files.Select(p => p.Name);

            int newfilecount = 0;
            foreach (var file in files)
            {

                foreach (var newfiles in filesTemp)
                {

                    if (newfiles == file.Name)
                    {
                        if (newfiles.Contains(app.Username))
                        {
                            newfilecount = newfilecount + 1;
                            PatientDataObj = new PatientData();
                            PatientDataObj.ID = count;
                            PatientDataObj.Image1 = new FileUploadCompleted();
                            PatientDataObj.Image1.Name = file.Name;
                            PatientDataObj.Image1.Status = 0;
                            PatientDataObj.Image1.Url = app.NormalBucketURL + file.Name;
                            PatientDataObj.Age = count + 20;
                            PatientDataObj.Sex = count % 2 == 0 ? DataModel.Gender.Male : DataModel.Gender.Female;
                            var properties = await file.GetBasicPropertiesAsync();
                            PatientDataObj.Image1.Size = Convert.ToInt32(properties.Size) / 1000000;
                            patientList.Add(PatientDataObj);
                            await Task.WhenAll(Task.Factory.StartNew(() => UploadFile(file.Name, file, PatientDataObj.Image1)));
                            ////await Task.WhenAll(Task.Run(() => UploadFile(file.Name, file, PatientDataObj.Image1)));   
                            //using (var semaphore = new SemaphoreSlim(MAX_PARALLEL_UPLOADS))
                            //{
                            //}
                        }
                    }

                  }


                  await storage.SaveAsync("UploadStat", patientList);
                  await currentUploadCount.SaveAsync("CurrentUploadCount", newfilecount);  
                  count = count + 1;
                }
            AutoDownload downloadObj = new AutoDownload();
            downloadObj.InitializeDownload();
        }
开发者ID:prashanthganathe,项目名称:PersonalProjects,代码行数:61,代码来源:AutoUpload.cs


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