Ejemplo n.º 1
0
 static void ParserServiceLoadSolutionProjectsThreadEnded(object sender, EventArgs e)
 {
     foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection.ToArray())
     {
         DisplayBindingService.AttachSubWindows(content, true);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Opens a new unsaved file.
        /// </summary>
        /// <param name="defaultName">The (unsaved) name of the to open</param>
        /// <param name="content">Content of the file to create</param>
        //public static IViewContent NewFile(string defaultName, string content)
        //{
        //    return NewFile(defaultName, ParserService.DefaultFileEncoding.GetBytesWithPreamble(content));
        //}

        /// <summary>
        /// Opens a new unsaved file.
        /// </summary>
        /// <param name="defaultName">The (unsaved) name of the to open</param>
        /// <param name="content">Content of the file to create</param>
        public static IViewContent NewFile(string defaultName, byte[] content)
        {
            if (defaultName == null)
            {
                throw new ArgumentNullException("defaultName");
            }
            if (content == null)
            {
                throw new ArgumentNullException("content");
            }

            IDisplayBinding binding = DisplayBindingService.GetBindingPerFileName(defaultName);

            if (binding == null)
            {
                binding = new ErrorFallbackBinding("Can't create display binding for file " + defaultName);
            }
            OpenedFile file = CreateUntitledOpenedFile(defaultName, content);

            IViewContent newContent = binding.CreateContentForFile(file);

            if (newContent == null)
            {
                LoggingService.Warn("Created view content was null - DefaultName:" + defaultName);
                file.CloseIfAllViewsClosed();
                return(null);
            }

            DisplayBindingService.AttachSubWindows(newContent, false);

            WorkbenchSingleton.Workbench.ShowView(newContent);
            return(newContent);
        }
Ejemplo n.º 3
0
            public void Invoke(string fileName)
            {
                OpenedFile file = FileService.GetOrCreateOpenedFile(FileName.Create(fileName));

                try {
                    IViewContent newContent = binding.CreateContentForFile(file);
                    if (newContent != null)
                    {
                        DisplayBindingService.AttachSubWindows(newContent, false);
                        WorkbenchSingleton.Workbench.ShowView(newContent, switchToOpenedView);
                    }
                } finally {
                    file.CloseIfAllViewsClosed();
                }
            }