Beispiel #1
0
        private bool EditMenuItemsChangeCallback(object context)
        {
            bool                    changed       = false;
            DeluxeTree              oControl      = (DeluxeTree)Component;
            IServiceProvider        site          = oControl.Site;
            IComponentChangeService changeService = null;

            try
            {
                DeluxeTreeItemsEditorForm oEditorForm = new DeluxeTreeItemsEditorForm(oControl);
                if (site != null)
                {
                    IUIService service = (IUIService)site.GetService(typeof(IUIService));
                    if (service != null)
                    {
                        if (service.ShowDialog(oEditorForm) == DialogResult.OK)
                        {
                            changed = true;
                        }
                    }
                }
            }
            finally
            {
                if (changed && changeService != null)
                {
                    changeService.OnComponentChanged(oControl, null, null, null);
                }
            }
            return(changed);
        }
Beispiel #2
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IDesignerHost service   = (IDesignerHost)context.GetService(typeof(IDesignerHost));
            DeluxeTree    component = (DeluxeTree)context.Instance;

            ((DeluxeTreeItemsDesigner)service.GetDesigner(component)).InvokeMenuItemCollectionEditor();
            return(value);
        }
        private void InnerTree_TargetControlLoaded(Control targetControl)
        {
            if ((targetControl is DeluxeTree) && targetControl.ID.IndexOf("oguInnerTree") >= 0)
            {
                DeluxeTree tree = (DeluxeTree)targetControl;

                tree.GetChildrenData += new DeluxeTree.GetChildrenDataDelegate(tree_GetChildrenData);
            }
        }
        protected override void CreateChildControls()
        {
            if (!this.ChildControlsCreated)
            {
                Controls.Clear();

                this.treeControl    = new DeluxeTree();
                this.treeControl.ID = "innerTree";
                //this.InitTree();

                this.Controls.Add(this.treeControl);
                this.ChildControlsCreated = true;
            }
        }
        protected override void CreateChildControls()
        {
            this.Style["overflow"] = "auto";

            this.tree    = new DeluxeTree();
            this.tree.ID = "oguInnerTree";
            this.tree.GetChildrenData += new DeluxeTree.GetChildrenDataDelegate(tree_GetChildrenData);
            this.tree.Width            = Unit.Percentage(100);
            this.tree.Height           = Unit.Percentage(100);

            if (this.CurrentMode == ControlShowingMode.Normal)
            {
                this.rootContainer = this;
                Controls.Add(this.tree);
            }

            base.CreateChildControls();
        }
Beispiel #6
0
        public DeluxeTreeItemsEditorForm(DeluxeTree oMenu)
        {
            InitializeComponent();

            this._firstActivate = true;
            _navBar             = oMenu;
            Items            = oMenu.Nodes;
            _serviceProvider = oMenu.Site;
            // add pre-existing nodes
            foreach (MCS.Web.WebControls.DeluxeTreeNode oRoot in Items)
            {
                TreeNode oRootNode = new TreeNode(oRoot.Text);
                LoadNodes(oRoot, oRootNode);
                _treeView.Nodes.Add(oRootNode);
            }
            this.propertyGrid1.Site = new FormPropertyGridSite(_serviceProvider, this.propertyGrid1);
            _treeView.HideSelection = false;
        }
Beispiel #7
0
        public override bool EditComponent(ITypeDescriptorContext context, object component, IWin32Window owner)
        {
            DeluxeTree              oControl      = (DeluxeTree)component;
            IServiceProvider        site          = oControl.Site;
            IComponentChangeService changeService = null;

            DesignerTransaction transaction = null;
            bool changed = false;

            try
            {
                if (site != null)
                {
                    IDesignerHost designerHost = (IDesignerHost)site.GetService(typeof(IDesignerHost));
                    transaction = designerHost.CreateTransaction("BuildMenu");

                    changeService = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
                    if (changeService != null)
                    {
                        try
                        {
                            changeService.OnComponentChanging(component, null);
                        }
                        catch (CheckoutException ex)
                        {
                            if (ex == CheckoutException.Canceled)
                            {
                                return(false);
                            }
                            throw ex;
                        }
                    }
                }

                try
                {
                    DeluxeTreeItemsEditorForm oEditorForm = new DeluxeTreeItemsEditorForm(oControl);
                    if (oEditorForm.ShowDialog(owner) == DialogResult.OK)
                    {
                        changed = true;
                    }
                }
                finally
                {
                    if (changed && changeService != null)
                    {
                        changeService.OnComponentChanged(oControl, null, null, null);
                    }
                }
            }
            finally
            {
                if (transaction != null)
                {
                    if (changed)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        transaction.Cancel();
                    }
                }
            }

            return(changed);
        }
 public DeluxeTreeItemsEditorForm(DeluxeTree oMenu)
 {
     InitializeComponent();
   
     this._firstActivate = true;
     _navBar = oMenu;
     Items = oMenu.Nodes;
     _serviceProvider = oMenu.Site;
     // add pre-existing nodes
     foreach (MCS.Web.WebControls.DeluxeTreeNode oRoot in Items)
     {
         TreeNode oRootNode = new TreeNode(oRoot.Text);
         LoadNodes(oRoot, oRootNode);
         _treeView.Nodes.Add(oRootNode);
     }
     this.propertyGrid1.Site = new FormPropertyGridSite(_serviceProvider, this.propertyGrid1);
     _treeView.HideSelection = false;
 }