コード例 #1
0
ファイル: SizeNode.cs プロジェクト: zouhao485/mwinapi
 public SizeNode(FolderInfo fi)
     : this(
         fi.DisplayName, fi.FullPath, fi.State, fi.Size, ExtendedFileInfo.GetIconForFilename(fi.FullPath, true), fi.FullPath)
 {
     this.folderInfo = fi;
     directories     = null; // not loaded yet
     if (fi.State == ScanState.SCANNING || fi.State == ScanState.DONE)
     {
         FillInFiles();
     }
     BuildDummyNode();
 }
コード例 #2
0
        private void BreadcrumbButtonOnMouseEnter(object sender, MouseEventArgs e)
        {
            if (!PressedMode)
            {
                return;
            }

            DropdownMenu.Items.Clear();

            var    button     = (LayeredButtonWithSkinElement)sender;
            string folderPath = ButtonToPath(sender);

            if (button.Text == "My Computer" || button.Text == "Computer")
            {
                foreach (DriveInfo d in DriveInfo.GetDrives())
                {
                    DropdownMenu.Items.Add(new LayeredPopupMenuItem(d.Name, d.Name, null));
                }
            }
            else if (Directory.Exists(folderPath))
            {
                string   Path    = ButtonToPath(sender);
                string[] folders = Directory.GetDirectories(Path);

                foreach (string folder in folders)
                {
                    String forldername = System.IO.Path.GetFileName(folder);
                    Icon   folderIcon  = ExtendedFileInfo.GetIconForFilename(folder, true);

                    var item = new LayeredPopupMenuItem(forldername, folder,
                                                        folderIcon.ToBitmap());

                    folderIcon.Dispose();

                    DropdownMenu.Items.Add(item);

                    if (_buttons.IndexOf(button) + 1 < _buttons.Count)
                    {
                        string folderbefore = ButtonToPath(_buttons[_buttons.IndexOf(button) + 1]);
                        folderbefore = folderbefore.Remove(folderbefore.Length - 1);

                        if (folder.Equals(folderbefore))
                        {
                            item.Bold = true;
                        }
                    }
                }
            }
            else
            {
                return;
            }

            foreach (LayeredButtonWithSkinElement layeredButton in _buttons)
            {
                layeredButton.ForceState = ButtonState.None;
            }

            button.HoverState = ButtonState.Pressed;
            button.ForceState = ButtonState.Pressed;

            if (BreadcrumbButton.ElementAlign == VerticalAlignment.right)
            {
                DropdownMenu.Left = Parent.Left + (button.Location.X - DropdownMenu.Width) + button.Size.Width / 2;
            }
            else
            {
                DropdownMenu.Left = Parent.Left + button.Location.X + button.Size.Width / 2;
            }

            DropdownMenu.Top = Parent.Top + button.Location.Y + button.Size.Height;

            if (DropdownMenu.Items.Count == 0)
            {
                DropdownMenu.Height = 0;
            }

            DropdownMenu.Show();
            DropdownMenu.ItemClicked += DropDownMenuItemClicked;
        }
コード例 #3
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     new FolderScanner(fqueue, this);
     new FolderScanner(fqueue, this);
     new FolderScanner(fqueue, this);
     foreach (String drive in Directory.GetLogicalDrives())
     {
         ToolStripMenuItem mi = new ToolStripMenuItem("&" + drive, Bitmap.FromHicon(ExtendedFileInfo.GetIconForFilename(drive, true).Handle));
         mi.Tag    = drive;
         mi.Click += new EventHandler(driveMenuItem_Click);
         scanToolStripMenuItem.DropDown.Items.Add(mi);
     }
     folderBrowser.SelectedPath = Directory.GetCurrentDirectory();
     ScanFolder();
 }