protected virtual TabItemUI CreateTabItem(string path) { TabItemUI ti = new TabItemUI(); ti.MaxWidth = 100; ti.Header = System.IO.Path.GetFileName(path); ti.DispGrid = this.CreateDataGrid(); ti.Go(path); ti.Content = ti.DispGrid; return(ti); }
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); }
protected virtual void PathPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { TabItemUI ti = this.tabControl.SelectedItem as TabItemUI; if (ti != null) { ti.Header = System.IO.Path.GetFileName(this.pathUI.Path); if (string.IsNullOrEmpty((string)ti.Header)) { ti.Header = this.pathUI.Path; } ti.Go(this.pathUI.Path); } }