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

            tab.FollowReference(@ref, Content, onShown);
            DocumentTabService.SetFocus(tab);
        }
Exemplo n.º 2
0
 public void TrySetFocus()
 {
     if (IsActiveTab)
     {
         DocumentTabService.SetFocus(this);
     }
 }
Exemplo n.º 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;
 }
Exemplo n.º 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);
        }
Exemplo n.º 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;
 }
Exemplo n.º 6
0
 public void TrySetFocus()
 {
     if (removed)
     {
         return;
     }
     if (IsActiveTab)
     {
         DocumentTabService.SetFocus(this);
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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;
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 11
0
 public void Close() => DocumentTabService.Close(this);
Exemplo n.º 12
0
 DocumentTabSerializer(IDocumentTabContentFactoryService documentTabContentFactoryService, DocumentTabService documentTabService)
 {
     this.documentTabContentFactoryService = documentTabContentFactoryService;
     this.documentTabService = documentTabService;
 }
Exemplo n.º 13
0
 DocumentTabServiceLoader(DocumentTabSerializer documentTabSerializer, DocumentTabService documentTabService, IDocumentListLoader documentListLoader)
 {
     this.documentTabSerializer = documentTabSerializer;
     this.documentTabService    = documentTabService;
     this.documentListLoader    = documentListLoader;
 }