Пример #1
0
        async void explorerDocPane_PropertyChanged(object sender, global::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 = global::System.Windows.Input.Cursors.Wait;
                                await _activeTabPage.SetExplorerObjectAsync(_selected[0]);

                                await _activeTabPage.OnShow();

                                this.Cursor = global::System.Windows.Input.Cursors.Arrow;
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        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);
        }