Esempio n. 1
0
        private void treeViewItems_BeforeSelect(object sender, TreeViewCancelEventArgs e)
        {
            if (e.Node == treeViewItems.Nodes[0])
            {
                return;
            }

            OptionsView view;

            if (e.Node.Tag is MarkeeConfiguration)
            {
                view = this.Controls.Cast <Control>().Single(x => x is FooterOptionsView) as FooterOptionsView;
            }
            else if (e.Node.Tag is TVConfiguration)
            {
                //tal tal tal
                return;
            }
            else
            {
                return;
            }

            if (visibleView != null)
            {
                configsAlteradas[treeViewItems.SelectedNode.Index] = visibleView.Configuration;
            }

            view.Configuration = configsAlteradas[e.Node.Index];

            if (visibleView != null && visibleView.GetType() != view.GetType())
            {
                foreach (var item in this.Controls.Cast <Control>().Where(x => x is OptionsView))
                {
                    item.Visible = false;
                }
            }

            view.Visible = true;

            visibleView = view;
        }
Esempio n. 2
0
        public FormOptionsBuilder(IEnumerable <ComposerComponent> componentList)
        {
            InitializeComponent();



            #region OLD
            int nodeIndex, typeindex = 0;

            List <Type> types = new List <Type>();

            foreach (var item in componentList)
            {
                if (!types.Contains(item.GetType()))
                {
                    types.Add(item.GetType());
                }
            }

            foreach (Type T in types)
            {
                OptionsView view = OptionsBuilderToolkit.GetViewFor(T);

                view.Dock    = DockStyle.Right;
                view.Left    = treeViewItems.Right + treeViewItems.Margin.Right;
                view.Visible = false;

                this.Controls.Add(view);

                foreach (var item in componentList.Where(x => x.GetType() == T))
                {
                    nodeIndex = treeViewItems.Nodes[0].Nodes.Add(OptionsBuilderToolkit.GetNodeFor(item, ++typeindex));

                    configsAlteradas.Add(nodeIndex, item.Configuration);
                    this.componentList.Add(item);
                }
            }
            #endregion
        }