public void AddRange(IEnumerable <FileItem> files)
        {
            if (dataGridView1.CurrentCell != null)
            {
                dataGridView1.BeginEdit(false);
            }
            try
            {
                foreach (var item in files)
                {
                    _files.Add(item);
                    switch (item.ItemType)
                    {
                    case FileItemType.File:
                        string ext = FileSystem.AddIcon(imlSmallIcons, item.Path, FileSystem.IconSize.Small);
                        item.Icon = imlSmallIcons.Images[ext];
                        break;

                    case FileItemType.Folder:
                        item.Icon = imlSmallIcons.Images["folder"];
                        break;
                    }
                }
            }
            finally
            {
                dataGridView1.EndEdit();
            }
        }
Exemple #2
0
 public FileItem(Models.File file, ImageList imageList) : base(file.DisplayName())
 {
     File     = file;
     ImageKey = FileSystem.AddIcon(imageList, file.Name ?? file.Path, FileSystem.IconSize.Small, "folder.png");
     SubItems.AddRange(new ListViewSubItem[]
     {
         new ListViewSubItem(this, file.Path),
         new ListViewSubItem(this, file.DateModified.ToString("M/d/yy h:mm t")),
         new ListViewSubItem(this, FileSystem.GetFileSize(file.Length))
     });
 }
Exemple #3
0
 public BlobItem(CloudBlockBlob blob, ImageList imageList, bool showPath = false) : base((showPath) ? blob.Name : Path.GetFileName(blob.Name))
 {
     Blob     = blob;
     ImageKey = FileSystem.AddIcon(imageList, blob.Name, FileSystem.IconSize.Small);
     SubItems.AddRange(new ListViewSubItem[]
     {
         new ListViewSubItem(this, blob.Properties.LastModified.Value.DateTime.ToString()),
         new ListViewSubItem(this, FileSystem.GetFileType(blob.Name)),
         new ListViewSubItem(this, FileSystem.GetFileSize(blob.Properties.Length)),
         new ListViewSubItem(this, blob.Properties.ContentType)
     });
 }
Exemple #4
0
        private async void bldPath_BuilderClicked(object sender, Library.Controls.BuilderEventArgs e)
        {
            if (bldPath.SelectFolder(e))
            {
                var files = await FileSystem.SearchAsync(e.Result);

                listView1.Items.Clear();
                var list = files.ToArray().Take(100);
                foreach (var file in list)
                {
                    var listItem = new ListViewItem(file.FullPath)
                    {
                        ImageKey = FileSystem.AddIcon(imageList1, file.FullPath, FileSystem.IconSize.Small)
                    };
                    listView1.Items.Add(listItem);
                }
            }
        }
Exemple #5
0
 public FileNode(FileInfo fileInfo, ImageList imageList) : base(Path.GetFileName(fileInfo.FullName))
 {
     ImageKey         = FileSystem.AddIcon(imageList, fileInfo.FullName, FileSystem.IconSize.Large, "folder.png");
     SelectedImageKey = ImageKey;
     FileInfo         = fileInfo;
 }