Exemplo n.º 1
0
        public static void SetListViewItemValues(ListViewItem item, FileSystemInfo fsi, ExRepListView listView)
        {
            if (item.ListView != null && item.ListView.InvokeRequired)
                item.ListView.Invoke(new SetListViewItemValuesDelegate(SetListViewItemValues), item, fsi, listView);
            else
            {
                List<ExRepListViewColumn> columns = listView.ColumnsSortedByIndex;

                if (columns.Count == 0)
                    throw new Exception("No columns to show in listview");

                item.Text = columns[0].Presenter.GetPresentation(fsi);

                if (columns[0].FontFamily != null)
                    item.Font = new Font(columns[0].FontFamily, item.Font.Size);

                for (int i = 1; i < columns.Count; i++)
                {
                    if (columns[i].FontFamily == null)
                        item.SubItems.Add(columns[i].Presenter.GetPresentation(fsi));
                    else
                        item.SubItems.Add(columns[i].Presenter.GetPresentation(fsi), item.ForeColor, item.BackColor, new Font(columns[i].FontFamily, item.Font.Size));
                }

                item.Tag = fsi;

                int iconImageIndex = GetIconImageIndex(fsi.FullName, listView);

                if(iconImageIndex != -1)
                    item.ImageIndex = GetIconImageIndex(fsi.FullName, listView);
            }
        }
Exemplo n.º 2
0
        public static ListViewItem Create(FileSystemInfo fsi, ExRepListView listView)
        {
            ListViewItem item = new ListViewItem();
            item.UseItemStyleForSubItems = false;

            SetListViewItemValues(item, fsi, listView);

            return item;
        }
Exemplo n.º 3
0
        public static ListViewItem Create(FileSystemInfo fsi, ExRepListView listView)
        {
            ListViewItem item = new ListViewItem();

            item.UseItemStyleForSubItems = false;

            SetListViewItemValues(item, fsi, listView);

            return(item);
        }
Exemplo n.º 4
0
        private static int GetIconImageIndex(string path, ExRepListView listView)
        {
            string iconLookupString = FileTypeIconHandler.GetIconLookupString(path);
            FileTypeIconInfo iconInfo = listView.IconHandler.AddIconToImageList(path, iconLookupString);

            if (iconInfo != null)
                return listView.IconHandler.IconInfoImageListIndexDict[iconInfo];
            else
                return -1;
        }
Exemplo n.º 5
0
        public ExRepListViewControl()
        {
            InitializeComponent();

            this.exRepListView = new ExRepListView();
            this.exRepListView.MessageHandler          = new MessageHandler(this.labelMessage);
            this.exRepListView.KeyboardShortcutHandler = new KeyboardShortcutHandler(Configuration.GetKeyboardShortcutMapping());
            this.exRepListView.IconHandler             = new FileTypeIconHandler(this.components);
            this.exRepListView.LocationTextBox         = new LocationTextBox(this.txtLocation);

            InitializeControls();
        }
Exemplo n.º 6
0
        public ExRepListViewControl()
        {
            InitializeComponent();

            this.exRepListView = new ExRepListView();
            this.exRepListView.MessageHandler = new MessageHandler(this.labelMessage);
            this.exRepListView.KeyboardShortcutHandler = new KeyboardShortcutHandler(Configuration.GetKeyboardShortcutMapping());
            this.exRepListView.IconHandler = new FileTypeIconHandler(this.components);
            this.exRepListView.LocationTextBox = new LocationTextBox(this.txtLocation);

            InitializeControls();
        }
Exemplo n.º 7
0
        private static int GetIconImageIndex(string path, ExRepListView listView)
        {
            string           iconLookupString = FileTypeIconHandler.GetIconLookupString(path);
            FileTypeIconInfo iconInfo         = listView.IconHandler.AddIconToImageList(path, iconLookupString);

            if (iconInfo != null)
            {
                return(listView.IconHandler.IconInfoImageListIndexDict[iconInfo]);
            }
            else
            {
                return(-1);
            }
        }
Exemplo n.º 8
0
        public static void SetListViewItemValues(ListViewItem item, FileSystemInfo fsi, ExRepListView listView)
        {
            if (item.ListView != null && item.ListView.InvokeRequired)
            {
                item.ListView.Invoke(new SetListViewItemValuesDelegate(SetListViewItemValues), item, fsi, listView);
            }
            else
            {
                List <ExRepListViewColumn> columns = listView.ColumnsSortedByIndex;

                if (columns.Count == 0)
                {
                    throw new Exception("No columns to show in listview");
                }

                item.Text = columns[0].Presenter.GetPresentation(fsi);

                if (columns[0].FontFamily != null)
                {
                    item.Font = new Font(columns[0].FontFamily, item.Font.Size);
                }

                for (int i = 1; i < columns.Count; i++)
                {
                    if (columns[i].FontFamily == null)
                    {
                        item.SubItems.Add(columns[i].Presenter.GetPresentation(fsi));
                    }
                    else
                    {
                        item.SubItems.Add(columns[i].Presenter.GetPresentation(fsi), item.ForeColor, item.BackColor, new Font(columns[i].FontFamily, item.Font.Size));
                    }
                }

                item.Tag = fsi;

                int iconImageIndex = GetIconImageIndex(fsi.FullName, listView);

                if (iconImageIndex != -1)
                {
                    item.ImageIndex = GetIconImageIndex(fsi.FullName, listView);
                }
            }
        }