Exemple #1
0
        private void DisplayCurrentPath()
        {
            Image  img  = null;
            string text = null;

            try
            {
                if (_curFolder != null)
                {
                    _prevPath = _curFolder.OrigItemPath;

                    img  = lvCatalogFolder.GetImageOfItemType(_curFolder.ItemType);
                    text = Translator.Translate("TXT_CURRENT_PATH", _curFolder.OrigItemPath);
                }
                else if (_cat != null)
                {
                    img  = ImageProvider.GetIconOfFileType("ctx");
                    text = Translator.Translate("TXT_CURRENT_PATH", _cat.Path);
                }
            }
            catch
            {
                img  = null;
                text = null;
            }

            EventDispatch.DispatchEvent(EventNames.SetMainStatusBar, text, img);
        }
        public WizMCSearchStep1Ctl()
        {
            InitializeComponent();
            this.tsmiProTONEPlay.Image    = ImageProcessing.Player16;
            this.tsmiProTONEEnqueue.Image = ImageProcessing.Player16;

            this.ShowImage     = false;
            this.ShowSeparator = false;

            ilImages            = new ImageList();
            ilImages.ImageSize  = new Size(16, 16);
            ilImages.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;

            ilImages.Images.Clear();

            ilImages.Images.Add(ImageProvider.GetIconOfFileType("ctx"));

            LoadShell32Image(Shell32Icon.DriveUnknown);
            LoadShell32Image(Shell32Icon.DriveNoRoot);
            LoadShell32Image(Shell32Icon.DriveRemovable);
            LoadShell32Image(Shell32Icon.DriveFixed);
            LoadShell32Image(Shell32Icon.DriveNetwork);
            LoadShell32Image(Shell32Icon.DriveCdrom);
            LoadShell32Image(Shell32Icon.DriveRamdisk);
            LoadShell32Image(Shell32Icon.GenericFolder);
            LoadShell32Image(Shell32Icon.GenericFile);

            lvResults.SmallImageList = ilImages;

            Translator.TranslateToolStrip(contextMenuStrip, DesignMode);
        }
        private void CreateItem(CatalogItem item)
        {
            CatalogItem byRootSerialNumber = theTask.Catalog.GetRootBySerialNumber(item.RootSerialNumber);
            string      str = (byRootSerialNumber != null) ? byRootSerialNumber.Name : Translator.Translate("TXT_NA");

            int imgIndex = -1;

            if (item.IsFolder)
            {
                imgIndex = (int)item.ItemType + 1;
            }
            else
            {
                string ext = PathUtils.GetExtension(item.OrigItemPath);
                if (ilImages.Images.ContainsKey(ext))
                {
                    imgIndex = ilImages.Images.IndexOfKey(ext);
                }
                else
                {
                    Image img = ImageProvider.GetIconOfFileType(ext);
                    if (img != null)
                    {
                        ilImages.Images.Add(img);
                        imgIndex = ilImages.Images.Count - 1;
                    }
                }
            }

            string[] data = new string[]
            {
                "",
                str,
                item.RootItemLabel,
                item.OrigItemPath
            };

            ListViewItem lvItem = new ListViewItem(data);

            lvItem.Tag        = item.VPath;
            lvItem.ImageIndex = imgIndex;

            lvResults.Items.Add(lvItem);
        }
Exemple #4
0
        public void DisplayCatalogFolder(Catalog cat, CatalogItem folder, CatalogItem prevFolder = null)
        {
            this.Items.Clear();

            _cat = cat;

            if (folder != null)
            {
                CatalogItem[] children = cat.GetByParentItemID(folder.ItemID);
                foreach (CatalogItem child in children)
                {
                    int imgIndex = 0;

                    if (child.IsFolder)
                    {
                        imgIndex = (int)child.ItemType + 1;
                    }
                    else
                    {
                        string ext = PathUtils.GetExtension(child.OrigItemPath);
                        if (ilItems.Images.ContainsKey(ext))
                        {
                            imgIndex = ilItems.Images.IndexOfKey(ext);
                        }
                        else
                        {
                            Image img = ImageProvider.GetIconOfFileType(ext);
                            if (img != null)
                            {
                                ilItems.Images.Add(ext, img);
                                imgIndex = ilItems.Images.Count - 1;
                            }
                        }
                    }

                    string[] data = new string[]
                    {
                        child.Name,
                        child.DateCreated,
                        child.OrigItemPath
                    };

                    ListViewItem item = new ListViewItem(data);
                    item.ImageIndex = imgIndex;
                    item.Tag        = child;

                    this.Items.Add(item);
                }

                bool selectFirst      = (this.Items.Count > 0);
                int  lastVisibleIndex = 0;

                foreach (ListViewItem item in this.Items)
                {
                    CatalogItem ci = item.Tag as CatalogItem;
                    if (ci != null && prevFolder != null && ci.VPath == prevFolder.VPath)
                    {
                        item.Selected = true;
                        item.Focused  = true;

                        lastVisibleIndex = item.Index;
                        selectFirst      = false;

                        break;
                    }
                }

                if (selectFirst)
                {
                    Items[0].Selected = true;
                    Items[0].Focused  = true;
                }
                else
                {
                    EnsureVisible(lastVisibleIndex);
                }

                this.Select();
                this.Focus();
            }
        }