Esempio n. 1
0
        private void btnAddFilter_Click(object sender, EventArgs e)
        {
            string text      = textBoxName.Text;
            Filter hasFilter = ProjectUtils.GetFilter(text);

            if (hasFilter != null)
            {
                InfoDialog.ShowDialog(this, "This filter already exists!", "Error!");
                return;
            }

            if (Globals.IsStringValid(text))
            {
                TreeNode newNode = new TreeNode(text);
                newNode.ContextMenuStrip = _filterStrip;
                newNode.ImageIndex       = newNode.SelectedImageIndex = newNode.StateImageIndex = 1;
                _node.Nodes.Add(newNode);
                Filter newSubFilter = _filter.AddSubFilter(text);
                string fullPath     = string.Format("{0}\\{1}", ProjectUtils.GetProjectDirectory(), newSubFilter.GetFilterDirectory());
                Directory.CreateDirectory(fullPath);

                _node.ExpandAll();
                Close();
            }
        }