Example #1
0
        protected virtual void TabSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TabItemUI ti = this.tabControl.SelectedItem as TabItemUI;

            if (ti != null)
            {
                this.pathUI.PropertyChanged -= PathPropertyChanged;
                this.pathUI.Path             = ti.Get();
                this.pathUI.PropertyChanged += PathPropertyChanged;
            }
        }
Example #2
0
        protected virtual TabItemUI CreateTabItem(ShellObject path)
        {
            TabItemUI ti = new TabItemUI();

            ti.MaxWidth = 100;
            ti.Header   = System.IO.Path.GetFileName(path.GetDisplayName(DisplayNameType.Default));

            ti.Go(path);

            ti.DispExpBrowser.ExplorerBrowserControl.NavigationComplete += (o, e) =>
            {
                Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser b = (Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser)o;
                b.Tag = e.NewLocation;

                TabItemUI tiui = this.tabControl.SelectedItem as TabItemUI;
                if (ti != null)
                {
                    this.pathUI.PropertyChanged -= PathPropertyChanged;
                    this.pathUI.Path             = tiui.Get();
                    this.pathUI.PropertyChanged += PathPropertyChanged;

                    tiui.Header = e.NewLocation.Name;
                    tiui.DispExpBrowser.ViewMode = Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserViewMode.Details;
                }
            };

            ContextMenu cm = new ContextMenu();
            MenuItem    mi = new MenuItem();

            mi.Header = "Close";
            mi.Click += (o, e) =>
            {
                this.tabControl.Items.Remove(ti);
            };
            cm.Items.Add(mi);

            mi        = new MenuItem();
            mi.Header = "BookMark";
            mi.Click += (o, e) =>
            {
                ShellObject shobj = (ShellObject)((TabItemUI)this.tabControl.SelectedItem).DispExpBrowser.ExplorerBrowserControl.Tag;
                string      key   = shobj.ParsingName;
                string      val   = shobj.Name;
                this.BookMarks.Add(new KeyValuePair <string, string>(key, val));
            };
            cm.Items.Add(mi);

            ti.ContextMenu = cm;

            return(ti);
        }