示例#1
0
        public void FollowReferenceNewTab(object @ref, Action <ShowTabContentEventArgs> onShown)
        {
            var tab = DocumentTabService.OpenEmptyTab();

            tab.FollowReference(@ref, Content, onShown);
            DocumentTabService.SetFocus(tab);
        }
示例#2
0
 public void TrySetFocus()
 {
     if (IsActiveTab)
     {
         DocumentTabService.SetFocus(this);
     }
 }
示例#3
0
 public ReloadAllHelper(DocumentTabService documentTabService)
 {
     this.documentTabService = documentTabService;
     originalDocuments       = new HashSet <IDsDocument>(documentTabService.DocumentTreeView.DocumentService.GetDocuments(), new DsDocumentComparer());
     old_disable_DocumentCollectionChanged = documentTabService.disable_DocumentCollectionChanged;
     documentTabService.disable_DocumentCollectionChanged = true;
 }
示例#4
0
        public IEnumerable <object> Restore(DocumentTabService documentTabService, IDocumentTabContentFactoryService documentTabContentFactoryService, ITabGroupService mgr)
        {
            mgr.IsHorizontal = IsHorizontal;
            for (int i = 0; i < TabGroups.Count; i++)
            {
                var stg = TabGroups[i];
                var g   = i == 0 ? mgr.ActiveTabGroup ?? mgr.Create() : mgr.Create();
                yield return(null);

                foreach (var o in stg.Restore(documentTabService, documentTabContentFactoryService, g))
                {
                    yield return(o);
                }
            }

            if (StackedContentState != null)
            {
                ((TabGroupService)mgr).StackedContentState = StackedContentState;
            }

            var ary = mgr.TabGroups.ToArray();

            if ((uint)Index < (uint)ary.Length)
            {
                mgr.ActiveTabGroup = ary[Index];
            }
            yield return(null);
        }
示例#5
0
 DocumentListLoader(IAppWindow appWindow, DocumentListService documentListService, DocumentTabService documentTabService, DocumentTabSerializer documentTabSerializer, [ImportMany] IEnumerable <Lazy <IDocumentListListener, IDocumentListListenerMetadata> > documentListListeners)
 {
     this.documentListService    = documentListService;
     this.documentTabService     = documentTabService;
     this.documentTabSerializer  = documentTabSerializer;
     this.documentListListeners  = documentListListeners.OrderBy(a => a.Metadata.Order).ToArray();
     appWindow.MainWindowClosed += AppWindow_MainWindowClosed;
 }
示例#6
0
 public void TrySetFocus()
 {
     if (removed)
     {
         return;
     }
     if (IsActiveTab)
     {
         DocumentTabService.SetFocus(this);
     }
 }
示例#7
0
        public void FollowReferenceNewTab(object @ref, Action <ShowTabContentEventArgs> onShown)
        {
            if (NotifyReferenceHandlers(@ref, Content, onShown))
            {
                return;
            }
            var tab = (TabContentImpl)DocumentTabService.OpenEmptyTab();

            tab.FollowReferenceCore(@ref, Content, onShown);
            DocumentTabService.SetFocus(tab);
        }
示例#8
0
 public TabContentImpl(DocumentTabService documentTabService, IDocumentTabUIContextLocator documentTabUIContextLocator, Lazy <IReferenceDocumentTabContentProvider, IReferenceDocumentTabContentProviderMetadata>[] referenceDocumentTabContentProviders, Lazy <IDefaultDocumentTabContentProvider, IDefaultDocumentTabContentProviderMetadata>[] defaultDocumentTabContentProviders)
 {
     this.elementZoomer = new TabElementZoomer();
     this.tabHistory    = new TabHistory();
     this.tabHistory.SetCurrent(new NullDocumentTabContent(), false);
     this.documentTabService                   = documentTabService;
     this.documentTabUIContextLocator          = documentTabUIContextLocator;
     this.referenceDocumentTabContentProviders = referenceDocumentTabContentProviders;
     this.defaultDocumentTabContentProviders   = defaultDocumentTabContentProviders;
     this.uiContext = new NullDocumentTabUIContext();
     this.uiObject  = this.uiContext.UIObject;
 }
示例#9
0
        public IEnumerable <object> Restore(DocumentTabService documentTabService, IDocumentTabContentFactoryService documentTabContentFactoryService, ITabGroup g)
        {
            foreach (var st in Tabs)
            {
                foreach (var o in st.TryRestore(documentTabService, documentTabContentFactoryService, g))
                {
                    yield return(o);
                }
            }
            var ary = g.TabContents.ToArray();

            if ((uint)Index < (uint)ary.Length)
            {
                g.ActiveTabContent = ary[Index];
            }
            yield return(null);
        }
示例#10
0
        public IEnumerable <object> TryRestore(DocumentTabService documentTabService, IDocumentTabContentFactoryService documentTabContentFactoryService, ITabGroup g)
        {
            var guid = Content.Attribute <Guid?>(CONTENT_GUID_ATTR);

            if (guid == null)
            {
                yield break;
            }
            var ctx = new GetNodesContext();

            foreach (var o in GetNodes(ctx, documentTabService.DocumentTreeView))
            {
                yield return(o);
            }
            if (ctx.Nodes == null)
            {
                yield break;
            }
            var tabContent = documentTabContentFactoryService.Deserialize(guid.Value, Content, ctx.Nodes);

            yield return(null);

            if (tabContent == null)
            {
                yield break;
            }
            documentTabService.Add(g, tabContent, null, (Action <ShowTabContentEventArgs>)(a => {
                if (a.Success)
                {
                    var uiContext = tabContent.DocumentTab.UIContext;
                    tabContent.DocumentTab.DeserializeUI((ISettingsSection)TabUI);
                    var obj = uiContext.DeserializeUIState(UI);
                    uiContext.RestoreUIState(obj);
                }
            }));
            yield return(null);
        }
示例#11
0
 public void Close() => DocumentTabService.Close(this);
示例#12
0
 DocumentTabSerializer(IDocumentTabContentFactoryService documentTabContentFactoryService, DocumentTabService documentTabService)
 {
     this.documentTabContentFactoryService = documentTabContentFactoryService;
     this.documentTabService = documentTabService;
 }
示例#13
0
 DocumentTabServiceLoader(DocumentTabSerializer documentTabSerializer, DocumentTabService documentTabService, IDocumentListLoader documentListLoader)
 {
     this.documentTabSerializer = documentTabSerializer;
     this.documentTabService    = documentTabService;
     this.documentListLoader    = documentListLoader;
 }