Esempio n. 1
0
 public DocumentWindow(IServiceProvider serviceProvider, Microsoft.Matrix.Core.Documents.Document document)
     : base(serviceProvider)
 {
     if (document == null)
     {
         throw new ArgumentNullException("document");
     }
     this._document = document;
     try
     {
         base.SuspendLayout();
         this.InitializeUserInterface();
         this._documentView = this.CreateDocumentView();
     }
     finally
     {
         base.ResumeLayout(true);
     }
     this._documentView.DocumentChanged += new EventHandler(this.OnDocumentViewDocumentChanged);
     this._viewCommandHandler = this._documentView as ICommandHandler;
     this._viewToolboxClient = this._documentView as IToolboxClient;
     this._viewSelectionContainer = this._documentView as ISelectionContainer;
     IDesigner designer = ((IDesignerHost) serviceProvider.GetService(typeof(IDesignerHost))).GetDesigner(document);
     this._designerCommandHandler = designer as ICommandHandler;
     this._contextCommandHandler = this._document.ProjectItem.Project;
     this.UpdateCaption();
 }
Esempio n. 2
0
 private void OnActiveDesignerChanged(object sender, ActiveDesignerEventArgs e)
 {
     bool flag = false;
     IToolboxClient client = this._activeClient;
     this._activeDesigner = e.NewDesigner;
     this._activeClient = null;
     if (this._activeDesigner != null)
     {
         this._activeClient = (IToolboxClient) e.NewDesigner.GetService(typeof(DocumentWindow));
     }
     if (client != this._activeClient)
     {
         if (((client != null) && (this._activeClient == null)) || ((client == null) && (this._activeClient != null)))
         {
             flag = true;
         }
         else if (client.GetType() != this._activeClient.GetType())
         {
             flag = true;
         }
     }
     if (!flag && (this._activeClient is IMultiViewDocumentWindow))
     {
         flag = true;
     }
     if (flag)
     {
         this.UpdateToolboxClient();
     }
 }
Esempio n. 3
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         IServiceContainer container = (IServiceContainer) this.GetService(typeof(IServiceContainer));
         if (container != null)
         {
             container.RemoveService(typeof(IToolboxService));
         }
         IToolboxService service = (IToolboxService) this.GetService(typeof(IToolboxService));
         if (service != null)
         {
             service.SectionAdded -= new ToolboxSectionEventHandler(this.OnSectionAdded);
             service.SectionRemoved -= new ToolboxSectionEventHandler(this.OnSectionRemoved);
             service.ActiveSectionChanged -= new ToolboxSectionEventHandler(this.OnActiveSectionChanged);
         }
         this._activeDesigner = null;
         this._activeClient = null;
         this._currentSection = null;
         IDesignerEventService service2 = (IDesignerEventService) this.GetService(typeof(IDesignerEventService));
         if (service2 != null)
         {
             service2.ActiveDesignerChanged -= new ActiveDesignerEventHandler(this.OnActiveDesignerChanged);
         }
     }
     base.Dispose(disposing);
 }