void explorerDocPane_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "SelectedContent") { if (explorerDocPane.SelectedContent is LayoutDocument && explorerDocPane.SelectedContent != _selectedLayoutDoc) { _selectedLayoutDoc = (LayoutDocument)explorerDocPane.SelectedContent; if (_selectedLayoutDoc != null) { IExplorerTabPage selectedPage = _tabPages.ExplorerTabPageByLayoutDocument(_selectedLayoutDoc); if (selectedPage != null && selectedPage != _activeTabPage) { _activeTabPage = selectedPage; if (_selected.Count == 1) { this.Cursor = System.Windows.Input.Cursors.Wait; _activeTabPage.ExplorerObject = _selected[0]; _activeTabPage.OnShow(); this.Cursor = System.Windows.Input.Cursors.Arrow; } } } } } }
async private Task ViewTabPages(IExplorerObject exObject) { explorerDocPane.PropertyChanged -= new global::System.ComponentModel.PropertyChangedEventHandler(explorerDocPane_PropertyChanged); List <IOrder> pages = new List <IOrder>(); foreach (TabPage tabPage in _tabPages) { IExplorerTabPage exTabPage = tabPage.ExTabPage; if (exTabPage == null || exTabPage.Control == null) { continue; } if (await exTabPage.ShowWith(exObject)) { pages.Add(exTabPage); } } pages.Sort(new SortByIOrder()); explorerDocPane.Children.Clear(); foreach (IOrder page in pages) { foreach (TabPage tabPage in _tabPages) { if (tabPage.ExTabPage == page) { explorerDocPane.Children.Add(tabPage.LayoutDoc); break; } } } explorerDocPane.SelectedContentIndex = 0; if (explorerDocPane.SelectedContent is LayoutDocument) { IExplorerTabPage selectedPage = ((WindowsFormsHost)explorerDocPane.SelectedContent.Content).Child as IExplorerTabPage; //if (selectedPage != _activeTabPage) { _activeTabPage = selectedPage; _selectedLayoutDoc = explorerDocPane.SelectedContent as LayoutDocument; if (_selected.Count == 1) { this.Cursor = global::System.Windows.Input.Cursors.Wait; this.Refresh(); await _activeTabPage.SetExplorerObjectAsync(_selected[0]); await _activeTabPage.OnShow(); this.Cursor = global::System.Windows.Input.Cursors.Arrow; this.Refresh(); } } } explorerDocPane.PropertyChanged += new global::System.ComponentModel.PropertyChangedEventHandler(explorerDocPane_PropertyChanged); }
public TabPage(IExplorerTabPage exTabPage, LayoutDocument layoutDoc) { ExTabPage = exTabPage; LayoutDoc = layoutDoc; }
public MainWindow() { try { InitializeComponent(); _application = new ExplorerApplication(this); _application.DockWindowAdded += new DockWindowAddedEvent(_application_DockWindowAdded); _application.OnShowDockableWindow += new OnShowDockableWindowEvent(_application_OnShowDockableWindow); #region Windows Forms Control Disign _toolStripAddress = new System.Windows.Forms.ToolStrip(); _toolStripAddress.Stretch = true; _toolStripAddress.GripMargin = new System.Windows.Forms.Padding(1); _toolStripAddress.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; _toolStripAddress.BackColor = System.Drawing.Color.White; winFormsHostStripAddress.Child = _toolStripAddress; #endregion _tree = new gView.Framework.UI.Dialogs.FormCatalogTree(_application, false); _tree.NodeSelected += new gView.Framework.UI.Dialogs.FormCatalogTree.NodeClickedEvent(tree_NodeSelected); _tree.NodeRenamed += new gView.Framework.UI.Dialogs.FormCatalogTree.NodeRenamedEvent(tree_NodeRenamed); _tree.NodeDeleted += new gView.Framework.UI.Dialogs.FormCatalogTree.NodeDeletedEvent(tree_NodeDeleted); //winFormsHostExplorerTree.Child = _tree; PlugInManager compMan = new PlugInManager(); foreach (XmlNode tabNode in compMan.GetPluginNodes(Plugins.Type.IExplorerTabPage)) { IExplorerTabPage page = (IExplorerTabPage)compMan.CreateInstance(tabNode); if (page == null || page.Control == null) continue; page.OnCreate(_application); LayoutDocument layoutDoc = new LayoutDocument(); layoutDoc.Title = layoutDoc.ContentId = page.Title; layoutDoc.CanClose = false; layoutDoc.CanFloat = false; layoutDoc.Content = new WindowsFormsHost(); ((WindowsFormsHost)layoutDoc.Content).Child = page.Control; _tabPages.Add(new TabPage(page, layoutDoc)); if (page is gView.Framework.UI.Controls.ContentsList) { ((gView.Framework.UI.Controls.ContentsList)page).ItemSelected += new gView.Framework.UI.Controls.ContentsList.ItemClickedEvent(ContentsList_ItemSelected); _content = (gView.Framework.UI.Controls.ContentsList)page; } } explorerDocPane.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(explorerDocPane_PropertyChanged); anchorPaneRight.Children[0].Hide(); _application.AddDockableWindow(_tree, DockWindowState.left); try { XmlDocument doc = new XmlDocument(); doc.Load("menu.explorer.xml"); MakeMainMenuBar(doc.SelectSingleNode("//Menubar")); } catch { } MakeRibbon(); ValidateButtons(); } catch(Exception ex) { System.Windows.MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }