private void Initialize()
        {
            ArrayList names = new ArrayList();

            names.AddRange(Enum.GetValues(typeof(FilterType)));

            RootNode = this.autoPlaylistTreeView.Nodes.Find("Root", false).FirstOrDefault();

            RootNode.NodeFont = new Font("Miramonte", 11, FontStyle.Bold);

            criteria = new TreeNodeComboBox("Click here to add a new filter..");
            ComboBox imageCombo = criteria.ComboBox;

            imageCombo.Name = "Criteria";
            imageCombo.Items.AddRange(names.ToArray());
            imageCombo.SelectedIndex = 0;

            condition = new TreeNodeComboBox("Click here to add a new condition..");
            condition.ComboBox.Name = "Condition";

            text_Value = new TreeNodeTextBox("Click here to set a new value..");
            TextBox valueText = text_Value.TextBox;

            text_Value.TextBox.Name = "Value";
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            this.autoPlaylistTreeView.Serialize(@"F:\prova.xml");

            TreeNodeComboBox newFilter = this.autoPlaylistTreeView.Nodes[0].Nodes[0] as TreeNodeComboBox;

            this.autoPlaylistTreeView.Nodes.Clear();
            var nodes = this.autoPlaylistTreeView.Deserialize(@"F:\prova.xml");

            this.RootNode = nodes[0];
            this.autoPlaylistTreeView.Nodes.Add(RootNode);

            nodes.Skip(1).ToList().ForEach(node => {
                node.NodeFont           = new Font("Miramonte", 9, FontStyle.Underline);
                node.ImageIndex         = 1;
                node.SelectedImageIndex = 1;
                RootNode.Nodes.Add(node);
            });

            this.RootNode.Nodes.Add(newFilter);

            this.autoPlaylistTreeView.ExpandAll();

            /*TreeNode c = new TreeNode("Mino");
             *
             * this.autoPlaylistTreeView.Nodes.Add(c);*/

            /*if (this.text_Value.Text.Length == 0)
             * {
             *  MessageBox.Show("First you need to named your automatic playlist.", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             *  return;
             * }
             *
             * this.autoPlaylistTreeView.Serialize(@"C:\prova.xml");*/
        }
Beispiel #3
0
        private void HideComboBox()
        {
            if (this.m_CurrentNode != null)
            {
                this.m_CurrentNode.ComboBox.SelectedValueChanged -= ComboBox_SelectedValueChanged;

                this.m_CurrentNode.Text = this.m_CurrentNode.ComboBox.Text;
                this.m_CurrentNode.ComboBox.Hide();
                this.m_CurrentNode.ComboBox.DroppedDown = false;

                this.Controls.Remove(this.m_CurrentNode.ComboBox);

                this.m_CurrentNode = null;
            }
        }
Beispiel #4
0
        protected override void OnNodeMouseClick(TreeNodeMouseClickEventArgs e)
        {
            if (e.Node is TreeNodeComboBox)
            {
                this.m_CurrentNode = e.Node as TreeNodeComboBox;

                this.Controls.Add(this.m_CurrentNode.ComboBox);

                this.m_CurrentNode.ComboBox.SetBounds(
                    this.m_CurrentNode.Bounds.X - 1,
                    this.m_CurrentNode.Bounds.Y - 2,
                    this.m_CurrentNode.Bounds.Width * 2,
                    this.m_CurrentNode.Bounds.Height);

                this.m_CurrentNode.ComboBox.SelectedValueChanged += new EventHandler(ComboBox_SelectedValueChanged);
                this.m_CurrentNode.ComboBox.Show();
                this.m_CurrentNode.ComboBox.DroppedDown = true;
            }
            else if (e.Node is TreeNodeTextBox)
            {
                this.textbox_node = (TreeNodeTextBox)e.Node;
                this.Controls.Add(this.textbox_node.TextBox);

                this.textbox_node.TextBox.SetBounds(
                    this.textbox_node.Bounds.X - 1,
                    this.textbox_node.Bounds.Y - 2,
                    this.textbox_node.Bounds.Width,
                    this.textbox_node.Bounds.Height);

                this.textbox_node.TextBox.KeyPress += new KeyPressEventHandler(TextBox_KeyPress);
                this.textbox_node.TextBox.Show();
                SendKeys.Send("{TAB}");
            }

            base.OnNodeMouseClick(e);
        }