Ejemplo n.º 1
0
        async Task <bool> OpenDocumentsInContainer(ProgressMonitor pm, FilePath baseDir, List <Tuple <Document, string> > docViews, List <DocumentUserPrefs> list, DockNotebookContainer container)
        {
            int          currentNotebook = -1;
            DockNotebook nb = container.GetFirstNotebook();

            foreach (var doc in list)
            {
                string fileName = baseDir.Combine(doc.FileName).FullPath;
                if (GetDocument(fileName) == null && File.Exists(fileName))
                {
                    if (doc.NotebookId != currentNotebook)
                    {
                        if (currentNotebook != -1 || nb == null)
                        {
                            nb = container.InsertRight(null);
                        }
                        currentNotebook = doc.NotebookId;
                    }
                    // TODO: Get the correct project.
                    var document = await documentManager.BatchOpenDocument(pm, fileName, null, doc.Line, doc.Column, nb);

                    if (document != null)
                    {
                        var t = new Tuple <Document, string> (document, fileName);
                        docViews.Add(t);
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
        async Task <bool> OpenDocumentsInContainer(ProgressMonitor pm, FilePath baseDir, List <Tuple <Document, string> > docViews, List <DocumentUserPrefs> list, DockNotebookContainer container)
        {
            int          currentNotebook = -1;
            DockNotebook nb = container.GetFirstNotebook();

            foreach (var doc in list)
            {
                string fileName = baseDir.Combine(doc.FileName).FullPath;
                if (GetDocument(fileName) == null && File.Exists(fileName))
                {
                    if (doc.NotebookId != currentNotebook)
                    {
                        if (currentNotebook != -1 || nb == null)
                        {
                            nb = container.InsertRight(null);
                        }
                        currentNotebook = doc.NotebookId;
                    }
                    // TODO: Get the correct project.
                    var document = await documentManager.BatchOpenDocument(pm, fileName, null, doc.Line, doc.Column, nb);

                    if (document != null)
                    {
                        try {
                            var tab = ((SdiWorkspaceWindow)document.Window).DockNotebookTab;
                            if (tab != null)
                            {
                                tab.IsPinned = doc.IsPinned;
                            }
                        } catch (Exception ex) {
                            LoggingService.LogInternalError(ex);
                        }

                        var t = new Tuple <Document, string> (document, fileName);
                        docViews.Add(t);
                    }
                }
            }
            return(true);
        }