Example #1
0
        private void TextBoxFilter_TextChanged(object sender, EventArgs e)
        {
            TextBox textBox = sender as TextBox;
            Plugin  plugin  = _currentListView.Tag as Plugin;

            if (!textBox.Visible)
            {
                return;
            }

            // Call FindItemWithText with the contents of the textbox.
            //ListViewItem foundItem = _currentListView.FindItemWithText(textBox.Text, false, 0, true);

            int          index     = _currentListView.FocusedItem.Index;
            ListViewItem foundItem = _currentListView.FindItemWithTextEx(textBox.Text, index, new[] { '[' });

            if (foundItem != null)
            {
                foreach (ListViewItem listViewItem in _currentListView.Items)
                {
                    if (listViewItem == foundItem)
                    {
                        listViewItem.Selected = true;
                        listViewItem.Focused  = true;
                        listViewItem.EnsureVisible();
                    }
                    else
                    {
                        listViewItem.Selected = false;
                    }
                }
            }
        }
Example #2
0
        private void CreateDriveButtons()
        {
            string[] drives = Directory.GetLogicalDrives();

            //Create volume buttons
            //TODO: detect changes to new attached or detached volumes
            for (int i = 0; i < 2; i++)
            {
                foreach (string drive in drives)
                {
                    Button button = new Button
                    {
                        Text     = drive,
                        Anchor   = AnchorStyles.Left | AnchorStyles.Top,
                        AutoSize = true,
                        TabStop  = false
                    };

                    if (i == 0)
                    {
                        button.Tag = SenderSide.Left.ToString();
                        leftFlowLayoutPanel.Controls.Add(button);
                    }
                    else
                    {
                        button.Tag = SenderSide.Right.ToString();
                        rightFlowLayoutPanel.Controls.Add(button);
                    }

                    button.Click += VolumeButton_Click;
                }
            }

            var fileSystemPlugin = new Plugin(@"C:\");

            //TODO: interim solution just init both listViews
            fileSystemPlugin.Entity.Seek(@"C:\");

            rightListView.Tag = fileSystemPlugin;
            rightListView.UpdateColumnHeaders(fileSystemPlugin.Entity.Tags);
            UpdateListBox(rightListView, fileSystemPlugin);

            leftListView.Tag = fileSystemPlugin;
            leftListView.UpdateColumnHeaders(fileSystemPlugin.Entity.Tags);
            UpdateListBox(leftListView, fileSystemPlugin);
        }