internal DesignerComponentCollection(SampleDesignerHost host) : base(new IComponent[0])
 {
     this.host = host;
     if (host.Sites != null)
     {
         foreach (ISite site in host.Sites.Values)
         {
             base.InnerList.Add(site.Component);
         }
     }
 }
 internal DesignerComponentCollection(SampleDesignerHost host)
     : base(new IComponent[0])
 {
     this.host = host;
     if (host.Sites != null)
     {
         foreach (ISite site in host.Sites.Values)
         {
             base.InnerList.Add(site.Component);
         }
     }
 }
        internal DesignerComponentCollection(SampleDesignerHost 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);
                }
            }
        }
 public SampleDesignerTransaction(SampleDesignerHost host, string description)
     : base(description)
 {
     int cObject0000;
     this.host = host;
     host.TransactionDescriptions.Push(description);
     host.TransactionCount = (cObject0000 = host.TransactionCount) + 1;
     if (cObject0000 == 0)
     {
         host.OnTransactionOpening(EventArgs.Empty);
         host.OnTransactionOpened(EventArgs.Empty);
     }
 }
Example #5
0
        public SampleDesignerTransaction(SampleDesignerHost host, string description) : base(description)
        {
            int cObject0000;

            this.host = host;
            host.TransactionDescriptions.Push(description);
            host.TransactionCount = (cObject0000 = host.TransactionCount) + 1;
            if (cObject0000 == 0)
            {
                host.OnTransactionOpening(EventArgs.Empty);
                host.OnTransactionOpened(EventArgs.Empty);
            }
        }
        public SampleDesignerTransaction(SampleDesignerHost 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);
            }
        }
Example #7
0
 void CreateDesigner(SampleDesignerLoader loader)
 {
     this.host = new SampleDesignerHost.SampleDesignerHost(this.hostingServiceContainer);
     this.propertyGrid.Site = new SampleDesignerApplication.PropertyGridSite(this.host, this);
     this.propertyGrid.PropertyTabs.AddTabType(typeof(System.Windows.Forms.Design.EventsTab));
     this.host.LoadDocument(loader);
     this.loader            = loader;
     this.ToolboxPane1.Host = this.host;
     this.host.View.Dock    = DockStyle.Fill;
     this.host.View.Visible = true;
     this.panelMain.Controls.Add(this.host.View);
     this.filter = new KeystrokeMessageFilter(this.host);
     Application.AddMessageFilter(this.filter);
     this.host.SelectionChanged += new EventHandler(host_SelectionChanged);
 }
Example #8
0
 void CreateDesigner(SampleDesignerLoader loader)
 {
     this.host = new SampleDesignerHost.SampleDesignerHost(this.hostingServiceContainer);
     this.propertyGrid.Site = new SampleDesignerApplication.PropertyGridSite(this.host, this);
     this.propertyGrid.PropertyTabs.AddTabType(typeof(System.Windows.Forms.Design.EventsTab));
     this.host.LoadDocument(loader);
     this.loader = loader;
     this.ToolboxPane1.Host = this.host;
     this.host.View.Dock = DockStyle.Fill;
     this.host.View.Visible = true;
     this.panelMain.Controls.Add(this.host.View);
     this.filter = new KeystrokeMessageFilter(this.host);
     Application.AddMessageFilter(this.filter);
     this.host.SelectionChanged += new EventHandler(host_SelectionChanged);
 }
Example #9
0
 protected override void OnCommit()
 {
     if (this.host != null)
     {
         Debug.Assert(this.host.TransactionDescriptions != null, "End batch operation with no desription?!?");
         string s = (string)this.host.TransactionDescriptions.Pop();
         if (--this.host.TransactionCount == 0)
         {
             DesignerTransactionCloseEventArgs dtc = new DesignerTransactionCloseEventArgs(true);
             this.host.OnTransactionClosing(dtc);
             this.host.OnTransactionClosed(dtc);
         }
         this.host = null;
     }
 }
 protected override void OnCommit()
 {
     if (this.host != null)
     {
         Debug.Assert(this.host.TransactionDescriptions != null, "End batch operation with no desription?!?");
         string s = (string) this.host.TransactionDescriptions.Pop();
         if (--this.host.TransactionCount == 0)
         {
             DesignerTransactionCloseEventArgs dtc = new DesignerTransactionCloseEventArgs(true);
             this.host.OnTransactionClosing(dtc);
             this.host.OnTransactionClosed(dtc);
         }
         this.host = null;
     }
 }
Example #11
0
        internal DesignerComponentCollection(SampleDesignerHost 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);
                }
            }
        }
        protected override void OnCancel() {
            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(false);
                    host.OnTransactionClosing(dtc);
                    host.OnTransactionClosed(dtc);
                }
                host = null;
            }
        }
Example #13
0
        public static Control GetCtrlFromClipBoard(SampleDesignerHost host)
        {
            Control ctrl = new Control();

            IDataObject ido = Clipboard.GetDataObject();

            if (ido.GetDataPresent(CBFormCtrl.Format.Name))
            {
                CBFormCtrl cbCtrl = ido.GetData("CF_DESIGNERCOMPONENTS_V2") as CBFormCtrl;

                ctrl = (Control)host.CreateComponent(cbCtrl.GetType(), cbCtrl.PartialName);
                ControlFactory.SetControlProperties(ctrl, cbCtrl.PropertyList);
            }
            //host.CreateComponent(ctrl.GetType, ctrl.Name );
            return(ctrl);
        }
Example #14
0
        public SampleDesignerTransaction(SampleDesignerHost 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);
            }
        }
Example #15
0
 private bool DestroyDesigner()
 {
     if (this.loader != null)
     {
         if (this.loader.PromptDispose())
         {
             Application.RemoveMessageFilter(this.filter);
             this.filter            = null;
             this.propertyGrid.Site = null;
             this.host.Dispose();
             this.loader = null;
             this.host   = null;
             return(true);
         }
         return(false);
     }
     return(true);
 }
Example #16
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;
            }
        }
Example #17
0
        /// This method is called whenever we create a new designer or
        /// load one from existing XML.
        private void CreateDesigner(SampleDesignerLoader loader)
        {
            // Our loader will handle loading the file (or creating a blank one).
            host = new SampleDesignerHost.SampleDesignerHost(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);
        }
Example #18
0
        /// This method is called whenever we create a new designer or
        /// load one from existing XML.
        private void CreateDesigner(SampleDesignerLoader loader)
        {
            // Our loader will handle loading the file (or creating a blank one).
            host = new SampleDesignerHost.SampleDesignerHost(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);
        }
Example #19
0
        /// This is called to destroy our designer (when we load a new one for example).
        /// It returns true if our environment has been cleared, false if not (if someone
        /// cancels a dispose when prompted to save changes).
        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);
        }
 internal SampleInheritedNameExtenderProvider(SampleDesignerHost host)
     : base(host)
 {
 }
Example #21
0
 internal SampleInheritedNameExtenderProvider(SampleDesignerHost host) : base(host)
 {
 }
 internal SampleNameExtenderProvider(SampleDesignerHost host)
 {
     this.host = host;
 }
 internal SampleNameExtenderProvider(SampleDesignerHost host)
 {
     this.host = host;
 }
        public static Control GetCtrlFromClipBoard(SampleDesignerHost host)
        {
            Control ctrl = new Control();

            IDataObject ido = Clipboard.GetDataObject();
            if (ido.GetDataPresent(CBFormCtrl.Format.Name))
            {
                CBFormCtrl cbCtrl = ido.GetData("CF_DESIGNERCOMPONENTS_V2") as CBFormCtrl;

                ctrl = (Control)host.CreateComponent(cbCtrl.GetType(), cbCtrl.PartialName);
                ControlFactory.SetControlProperties(ctrl, cbCtrl.PropertyList);

            }
            //host.CreateComponent(ctrl.GetType, ctrl.Name );
            return ctrl;
        }
Example #25
0
		/// This is called to destroy our designer (when we load a new one for example).
		/// It returns true if our environment has been cleared, false if not (if someone
		/// cancels a dispose when prompted to save changes).
        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;
        }
 internal SampleDesignSite(SampleDesignerHost host, string name)
 {
     this.host = host;
     this.component = null;
     this.name = name;
 }
Example #27
0
 private bool DestroyDesigner()
 {
     if (this.loader != null)
     {
         if (this.loader.PromptDispose())
         {
             this.tabControl.Visible = false;
             this.menuItemSave.Enabled = false;
             this.menuItemSaveAs.Enabled = false;
             this.menuItemEdit.Enabled = false;
             this.menuItemView.Enabled = false;
             this.menuItemLayout.Enabled = false;
             this.menuItemDebug.Enabled = false;
             this.panelMain.Controls.Clear();
             Application.RemoveMessageFilter(this.filter);
             this.filter = null;
             this.propertyGrid.Site = null;
             this.host.Dispose();
             this.loader = null;
             this.host = null;
             return true;
         }
         return false;
     }
     return true;
 }
Example #28
0
 private void CreateDesigner(SampleDesignerLoader loader)
 {
     this.host = new SampleDesignerHost(this.hostingServiceContainer);
     this.propertyGrid.Site = new SampleDesignerApplication.PropertyGridSite(this.host, this);
     this.propertyGrid.PropertyTabs.AddTabType(typeof(EventsTab));
     this.host.LoadDocument(loader);
     this.loader = loader;
     this.toolbox.Host = this.host;
     this.host.View.Dock = DockStyle.Fill;
     this.host.View.Visible = true;
     this.panelMain.Controls.Add(this.host.View);
     this.tabControl.Visible = true;
     this.menuItemSave.Enabled = true;
     this.menuItemSaveAs.Enabled = true;
     this.menuItemEdit.Enabled = true;
     this.menuItemView.Enabled = true;
     this.menuItemLayout.Enabled = true;
     this.menuItemDebug.Enabled = true;
     this.filter = new KeystrokeMessageFilter(this.host);
     Application.AddMessageFilter(this.filter);
     this.host.SelectionChanged += new EventHandler(host_SelectionChanged);
 }
Example #29
0
 internal SampleDesignSite(SampleDesignerHost host, string name)
 {
     this.host      = host;
     this.component = null;
     this.name      = name;
 }
Example #30
0
 private bool DestroyDesigner()
 {
     if (this.loader != null)
     {
         if (this.loader.PromptDispose())
         {
             Application.RemoveMessageFilter(this.filter);
             this.filter = null;
             this.propertyGrid.Site = null;
             this.host.Dispose();
             this.loader = null;
             this.host = null;
             return true;
         }
         return false;
     }
     return true;
 }