Esempio n. 1
0
        private void InitPlugins()
        {
            if (PluginWrapper == null)
                PluginWrapper = new BrowserPluginWrapper();

            while (fileView.Columns.Count > 1)
                fileView.Columns.RemoveAt(1);

            ColumnHeader header;
            MenuItem item;
            foreach (IColumnPlugin columnPlugin in PluginWrapper.ColumnPlugins)
            {
                foreach (string columnName in columnPlugin.ColumnNames)
                {
                    item = new MenuItem(columnName);
                    item.Checked = true;
                    item.Click += new EventHandler(ColumnContextItem_Click);
                    columnContextMenu.MenuItems.Add(item);

                    header = new ColumnHeader();
                    header.TextAlign = columnPlugin.GetAlignment(columnName);
                    header.Text = columnName;
                    header.Name = header.Text;
                    header.Tag = columnPlugin;
                    header.Width = 0;

                    fileView.Columns.Add(header);
                }
            }

            fileView.ColumnHeaderContextMenu = columnContextMenu;
        }
        /// <summary>
        /// Registers the neccesairy events
        /// </summary>
        /// <param name="br">The browser for which to support the ContextMenu</param>
        public BrowserLVContextMenuWrapper(ShellBrowser br, BrowserPluginWrapper pluginWrapper)
        {
            this.br = br;
            this.pluginWrapper = pluginWrapper;

            provider = new StreamStorageProvider(FileAccess.ReadWrite);
            viewPluginWorker = new BackgroundWorker();
            viewPluginWorker.DoWork += new DoWorkEventHandler(backgroundWorker_DoWork);
            viewPluginTimer = new System.Windows.Forms.Timer();
            viewPluginTimer.Tick += new EventHandler(viewPluginTimer_Tick);
            viewPluginTimer.Interval = 300;

            br.FileView.ShowItemToolTips = true;
            toolTipDelegate = new ToolTipDelegate(SetToolTip);

            br.SelectedFolderChanged += new SelectedFolderChangedEventHandler(br_SelectedFolderChanged);

            br.FileView.LabelEdit = true;
            br.FileView.MouseUp += new MouseEventHandler(FileView_MouseUp);
            br.FileView.ItemActivate += new EventHandler(FileView_ItemActivate);
            br.FileView.AfterLabelEdit += new LabelEditEventHandler(FileView_AfterLabelEdit);
            br.FileView.BeforeLabelEdit += new LabelEditEventHandler(FileView_BeforeLabelEdit);
            br.FileView.KeyDown += new KeyEventHandler(FileView_KeyDown);
            br.FileView.ItemSelectionChanged += new ListViewItemSelectionChangedEventHandler(FileView_ItemSelectionChanged);
            br.FileView.ItemMouseHover += new ListViewItemMouseHoverEventHandler(FileView_ItemMouseHover);

            this.CreateHandle(new CreateParams());
        }