Esempio n. 1
0
        public WidgetReferenceCtrl(IWidgetItem item, IEditorService edsvc)
            : this()
        {
            _widgetRef = item;
            _flexLayout = (IApplicationDefinition)edsvc.GetEditedResource();
            _fsvc = (IFusionService)edsvc.GetService((int)ServiceType.Fusion);
            _context = new FlexibleLayoutEditorContext(_fsvc);
            cmbWidgetRefs.DataSource = _context.GetDockableWidgetNames(_flexLayout);

            cmbWidgetRefs.SelectedItem = item.Widget;
            _init = false;
        }
        public WidgetReferenceCtrl(IWidgetItem item, IEditorService edsvc)
            : this()
        {
            _widgetRef  = item;
            _flexLayout = (IApplicationDefinition)edsvc.GetEditedResource();
            _fsvc       = (IFusionService)edsvc.GetService((int)ServiceType.Fusion);
            _context    = new FlexibleLayoutEditorContext(_fsvc);
            cmbWidgetRefs.DataSource = _context.GetDockableWidgetNames(_flexLayout);

            cmbWidgetRefs.SelectedItem = item.Widget;
            _init = false;
        }
        private void widgetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var cnt = this.SelectedContainer;

            if (cnt != null)
            {
                string[] widgets = _context.GetDockableWidgetNames(_flexLayout);
                string   widget  = GenericItemSelectionDialog.SelectItem(
                    Strings.AddWidgetReference,
                    Strings.SelectWidget,
                    widgets);
                if (widget != null)
                {
                    //at end
                    var item = _flexLayout.CreateWidgetReference(widget);
                    cnt.Insert(item, cnt.ItemCount);
                    this.SelectedNode.Nodes.Add(CreateNode(item));
                }
            }
            else
            {
                var menu = this.SelectedNode.Tag as IMenu;
                if (menu != null)
                {
                    string[] widgets = _context.GetDockableWidgetNames(_flexLayout);
                    string   widget  = GenericItemSelectionDialog.SelectItem(
                        Strings.AddWidgetReference,
                        Strings.SelectWidget,
                        widgets);
                    if (widget != null)
                    {
                        //at end
                        var item = _flexLayout.CreateWidgetReference(widget);
                        menu.Insert(item, menu.ItemCount);
                        this.SelectedNode.Nodes.Add(CreateNode(item));
                    }
                }
            }
        }