コード例 #1
0
ファイル: DirectoryView.cs プロジェクト: jezlove/ReSearcher
 protected static ListViewItem file(FileInfo fileInfo)
 {
     if (!smallImageCache.Images.ContainsKey(fileInfo.Extension))
     {
         Tuple <String, Icon> tuple = IconUtilities.getFileTypeAndIcon(fileInfo.FullName, true);
         typeNameCache.Add(fileInfo.Extension, tuple.Item1);
         smallImageCache.Images.Add(fileInfo.Extension, tuple.Item2);
     }
     return(
         new ListViewItem()
     {
         Text = fileInfo.Name, ImageKey = fileInfo.Extension, Tag = fileInfo
     }.withSubItems(
             new ListViewItem.ListViewSubItem()
     {
         Text = typeNameCache[fileInfo.Extension]
     },
             new ListViewItem.ListViewSubItem()
     {
         Text = IecByteMultiples.format(fileInfo.Length)
     },
             new ListViewItem.ListViewSubItem()
     {
         Text = fileInfo.LastWriteTime.ToString(iso8601FormatString)
     }
             )
         );
 }
コード例 #2
0
        public void display(IEnumerable <Tuple <String, IEnumerable <KeyValuePair <String, List <IDownloadableResourceFile> > > > > downloadMappings)
        {
            using (new ListViewUpdate(this)) {
                Groups.Clear();
                Items.Clear();
                foreach (Tuple <String, IEnumerable <KeyValuePair <String, List <IDownloadableResourceFile> > > > grouping in downloadMappings)
                {
                    ListViewGroup listViewGroup = new ListViewGroup(grouping.Item1, HorizontalAlignment.Left)
                    {
                        Tag = grouping
                    };
                    Groups.Add(listViewGroup);
                    foreach (KeyValuePair <String, List <IDownloadableResourceFile> > kvp in grouping.Item2)
                    {
                        // TODO: allow user to select what to do in case of conflict

                        IDownloadableResourceFile downloadableResourceFile = kvp.Value[0];

                        Items.Add(
                            new ListViewItem()
                        {
                            Tag = kvp, Checked = true, Group = listViewGroup
                        }.withSubItems(
                                new ListViewItem.ListViewSubItem()
                        {
                            Text = downloadableResourceFile.name
                        },
                                new ListViewItem.ListViewSubItem()
                        {
                            Text = downloadableResourceFile.type
                        },
                                new ListViewItem.ListViewSubItem()
                        {
                            Text = IecByteMultiples.format(downloadableResourceFile.size)
                        },
                                new ListViewItem.ListViewSubItem()
                        {
                            Text = downloadableResourceFile.location
                        }
                                )
                            );
                    }
                }
                AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            }
        }
コード例 #3
0
 public void updateStatusStrip()
 {
     numberOfFilesSelectedToolStripStatusLabel.Text = String.Format("{0} file(s) selected", downloadableResourceFileListView.CheckedItems.Count);
     totalSizeToolStripStatusLabel.Text             = String.Format("Size: {0}", IecByteMultiples.format(downloadableResourceFileListView.sumChecked()));
 }