コード例 #1
0
        async Task <Document> ShowView(DocumentOpenInformation documentOpenInfo)
        {
            if (IdeApp.Workbench != null)
            {
                IdeApp.Workbench.EnsureShown();
            }

            await InitDesktopService();

            var commandHandler = new ViewCommandHandlers();

            // If the controller has not been initialized, do it now
            if (!documentOpenInfo.DocumentController.Initialized)
            {
                await documentOpenInfo.DocumentController.Initialize(null, null);
            }

            // Make sure the shell is now initialized
            await ServiceProvider.GetService <IShell> ();

            var window = await workbench.ShowView(documentOpenInfo.DocumentController, documentOpenInfo.DockNotebook, commandHandler);

            var doc = new Document(this, workbench, documentOpenInfo.DocumentController, documentOpenInfo.DocumentControllerDescription, window);

            // Don't wait for the view to be initialized. The document can be made visible and can be functional before getting the view.
            doc.InitializeViewAsync().Ignore();

            doc.Closing += OnWindowClosing;
            doc.Closed  += OnWindowClosed;
            doc.Window.NotebookChanged += Window_NotebookChanged;
            documents = documents.Add(doc);
            WatchDocument(doc);

            OnDocumentOpened(new DocumentEventArgs(doc));

            if (documentOpenInfo.Options.HasFlag(OpenDocumentOptions.BringToFront) || documents.Count == 1)
            {
                doc.Select();
            }

            // Ensure the active document is up to date
            OnDocumentChanged(null, null);

            commandHandler.Initialize(doc);

            CountFileOpened(documentOpenInfo.DocumentController);

            return(doc);
        }
コード例 #2
0
		public SdiWorkspaceWindow (DefaultWorkbench workbench, IViewContent content, Notebook tabControl, TabLabel tabLabel) : base ()
		{
			this.workbench = workbench;
			this.tabControl = tabControl;
			this.content = content;
			this.tabLabel = tabLabel;
			this.tabPage = content.Control;
			
			content.WorkbenchWindow = this;
			
			content.ContentNameChanged += new EventHandler(SetTitleEvent);
			content.DirtyChanged       += new EventHandler(SetTitleEvent);
			content.BeforeSave         += new EventHandler(BeforeSave);
			content.ContentChanged     += new EventHandler (OnContentChanged);
			
			ShadowType = ShadowType.None;
			box = new VBox ();
			box.PackStart (content.Control);
			Add (box);
			box.Show ();
			
			SetTitleEvent(null, null);
			
			commandHandler = new ViewCommandHandlers (this);
			Show ();
		}
コード例 #3
0
		public SdiWorkspaceWindow (DefaultWorkbench workbench, IViewContent content, Notebook tabControl, TabLabel tabLabel) : base ()
		{
			this.workbench = workbench;
			this.tabControl = tabControl;
			this.content = content;
			this.tabLabel = tabLabel;
			this.tabPage = content.Control;
			
			ShadowType = ShadowType.None;
			box = new VBox ();
			Add (box);
			box.PackStart (content.Control);
			
			fileTypeCondition.SetFileName (content.ContentName ?? content.UntitledName);
			extensionContext = AddinManager.CreateExtensionContext ();
			extensionContext.RegisterCondition ("FileType", fileTypeCondition);
			
			content.WorkbenchWindow = this;
			
			content.ContentNameChanged += new EventHandler(SetTitleEvent);
			content.DirtyChanged       += new EventHandler(SetTitleEvent);
			content.BeforeSave         += new EventHandler(BeforeSave);
			content.ContentChanged     += new EventHandler (OnContentChanged);
			
			box.Show ();
			
			SetTitleEvent(null, null);
			
			commandHandler = new ViewCommandHandlers (this);
			Show ();
		}