Ejemplo n.º 1
0
        /// <summary>
        /// 数据绑定
        /// </summary>
        protected void BindData()
        {
            List <FileSystemInfo> list = new List <FileSystemInfo>();

            foreach (var item in DestFolder.GetDirectories())
            {
                list.Add(item);
            }
            foreach (String k in FileType.Split(';'))
            {
                foreach (var item in DestFolder.GetFiles(k))
                {
                    list.Add(item);
                }
            }

            //list.Sort(delegate(FileSystemInfo t1, FileSystemInfo t2)
            //{
            //    return t1.Attributes.CompareTo(t2.Attributes);
            //});
            if (displayMode == DisplayMode.列表)
            {
                Repeater1.DataSource = list;
                Repeater1.DataBind();
            }
            else
            {
                Repeater2.DataSource = list;
                Repeater2.DataBind();
            }
        }
Ejemplo n.º 2
0
        public override XElement ToXml()
        {
            var xml = base.ToXml();

            xml.SetAttributeValue("fileName", FileName);
            xml.Add(DestFolder.ToXml("destFolder"));
            return(xml);
        }
Ejemplo n.º 3
0
        protected override async Task OnStartAsync()
        {
            var destFolder = DestFolder;

            if (destFolder == null && Common.IsSingle(Parents) && Parents[0] is CreateFolderTask)
            {
                destFolder = ((CreateFolderTask)Parents[0]).CreatedFolder;
            }

            // sync dest folder on all drives
            var tasks = (from drive in Account.Drives
                         where DestFolder.GetDriveFile(drive) == null
                         select DestFolder.GetFileAndCreateIfFolderIsNotExistsAsync(drive, CancellationTokenSource.Token)
                         ).Cast <Task>().ToList();
            await Task.WhenAll(tasks);

            UploadedFile = await
                           Account.UploadFileAsync(FileName, destFolder, CancellationTokenSource.Token,
                                                   e => OnProgress(new AsyncTaskProgressEventArgs(e.PercentDone, null)));
        }