コード例 #1
0
        internal DesignerComponentCollection(EtoDesignerHost host) : base(new IComponent[0])
        {
            this.host = host;

            // Initially fill the list with site data.  After the initial fill it is up to
            // those who modify the Sites hash to update us.
            //
            if (host.Sites != null)
            {
                foreach (ISite site in host.Sites.Values)
                {
                    InnerList.Add(site.Component);
                }
            }
        }
コード例 #2
0
        public EtoDesignerTransaction(EtoDesignerHost host, string description) : base(description)
        {
            this.host = host;

            // The host keeps a string stack of the transaction descriptions.
            host.TransactionDescriptions.Push(description);

            // If this is first transaction to be opened, have the host raise
            // opening/opened events.
            //
            if (host.TransactionCount++ == 0)
            {
                host.OnTransactionOpening(EventArgs.Empty);
                host.OnTransactionOpened(EventArgs.Empty);
            }
        }
コード例 #3
0
        protected override void OnCommit()
        {
            if (host != null)
            {
                Debug.Assert(host.TransactionDescriptions != null, "End batch operation with no desription?!?");
                string s = (string)host.TransactionDescriptions.Pop();

                // If this is the last transaction to be closed, have the host raise
                // closing/closed events.
                //
                if (--host.TransactionCount == 0)
                {
                    DesignerTransactionCloseEventArgs dtc = new DesignerTransactionCloseEventArgs(true);
                    host.OnTransactionClosing(dtc);
                    host.OnTransactionClosed(dtc);
                }
                host = null;
            }
        }
コード例 #4
0
        //
        //
        private void CreateDesigner(EtoDesignerLoader loader)
        {
            // Our loader will handle loading the file (or creating a blank one).
            host = new EtoDesignerHost(hostingServiceContainer);

            // The limited events tab functionality we have requires a special kind of
            // property grid site.
            //
            propertyGrid.Site = new PropertyGridSite(host as IServiceProvider, this);
            propertyGrid.PropertyTabs.AddTabType(typeof(EventsTab));

            host.LoadDocument(loader);
            this.loader = loader;

            // The toolbox needs access to the IToolboxService and the designers.
            toolbox.Host = host;

            // Initialize our document window.
            host.View.Dock    = DockStyle.Fill;
            host.View.Visible = true;
            panelMain.Controls.Add(host.View);

            // These are normally unavailable if we've got no host created.
            // Otherwise we gets lots of null reference exceptions.
            //
            tabControl.Visible     = true;
            menuItemSave.Enabled   = true;
            menuItemSaveAs.Enabled = true;
            menuItemEdit.Enabled   = true;
            menuItemView.Enabled   = true;
            menuItemLayout.Enabled = true;
            menuItemDebug.Enabled  = true;

            // This IMessageFilter is used to intercept and decipher keyboard presses
            // that might be instructions for our designer. We have to do it this way
            // since we can't have our designer raise KeyPress events.
            //
            filter = new KeystrokeMessageFilter(host);
            Application.AddMessageFilter(filter);
        }
コード例 #5
0
        //
        //
        //
        private bool DestroyDesigner()
        {
            if (loader != null)
            {
                if (loader.PromptDispose())
                {
                    // Again, bad things happen if there's no host loaded and
                    // certain buttons are pressed in our TabControl or MainMenu.
                    //
                    tabControl.Visible     = false;
                    menuItemSave.Enabled   = false;
                    menuItemSaveAs.Enabled = false;
                    menuItemEdit.Enabled   = false;
                    menuItemView.Enabled   = false;
                    menuItemLayout.Enabled = false;
                    menuItemDebug.Enabled  = false;

                    // Get rid of our document window.
                    panelMain.Controls.Clear();

                    // No need to filter for designer-intended keyboard strokes now.
                    Application.RemoveMessageFilter(filter);
                    filter = null;

                    // Get rid of that property grid site so it doesn't ask for
                    // any more services from our soon-to-be-disposed host.
                    //
                    propertyGrid.Site = null;

                    host.Dispose();
                    loader = null;
                    host   = null;
                    return(true);
                }
                return(false);
            }
            return(true);
        }
コード例 #6
0
 internal EtoNameExtenderProvider(EtoDesignerHost host)
 {
     this.host = host;
 }
コード例 #7
0
 internal EtoInheritedNameExtenderProvider(EtoDesignerHost host) : base(host)
 {
 }
コード例 #8
0
 internal EtoDesignSite(EtoDesignerHost host, string name)
 {
     this.host      = host;
     this.component = null;
     this.name      = name;
 }