void empty_selection_in_FilterBox()
 {
     //clear FilterBox from selection to give a possibility adding filter to 0 level
     FilterTree.SelectedNode = null;
     CurrentFilterControl    = null;
     //Filter_flowLayoutPanel.BackColor = Color.Empty;
     pLevelHighlight.BackColor = Color.Empty;
     InputGroupName.Items.Clear();
     FilterComment.Text = "";
 }
        /// <summary>
        /// on new filter tree node was selected
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FilterTree_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                TreeNode stn = (TreeNode)FilterTree.SelectedNode;
                if (stn == null)
                {
                    return;
                }

                fill_InputGroupName();

                Filter f = (Filter)stn.Tag;
                CurrentFilterControl = f.CreateControl();
                FilterType.Text      = f.ReadableTypeName;
                //Filter_flowLayoutPanel.BackColor = stn.BackColor;
                pLevelHighlight.BackColor = stn.BackColor;
                FilterComment.Text        = f.Comment;
            }
            catch (Exception ex)
            {
                Message.Error(ex);
            }
        }
 void empty_selection_in_FilterBox()
 {
     //clear FilterBox from selection to give a possibility adding filter to 0 level
     FilterTree.SelectedNode = null;
     CurrentFilterControl = null;
     //Filter_flowLayoutPanel.BackColor = Color.Empty;
     pLevelHighlight.BackColor = Color.Empty;
     InputGroupName.Items.Clear();
     FilterComment.Text = "";
 }
        /// <summary>
        /// on new filter tree node was selected
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FilterTree_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                TreeNode stn = (TreeNode)FilterTree.SelectedNode;
                if (stn == null)
                    return;

                fill_InputGroupName();

                Filter f = (Filter)stn.Tag;
                CurrentFilterControl = f.CreateControl();
                FilterType.Text = f.ReadableTypeName;
                //Filter_flowLayoutPanel.BackColor = stn.BackColor;
                pLevelHighlight.BackColor = stn.BackColor;
                FilterComment.Text = f.Comment;
            }
            catch (Exception ex)
            {
                Message.Error(ex);
            }
        }
        /// <summary>
        /// Load filter tree from xml file
        /// </summary>
        /// <param name="filter_tree_xml_file"></param>
        internal void LoadFilterTree(string filter_tree_xml_file)
        {
            try
            {
                FilterTree.Nodes.Clear();
                CurrentFilterControl = null;
               // Filter_flowLayoutPanel.BackColor = Color.Empty;
                pLevelHighlight.BackColor = Color.Empty;
                InputGroupName.Items.Clear();
                FilterComment.Text = "";

                if (filter_tree_xml_file == null)
                    return;

                this.Text = filter_tree_xml_file.Substring(filter_tree_xml_file.LastIndexOf("\\") + 1) + " " + title;

                //create filter tree
                Parser p = new Parser(filter_tree_xml_file);
                foreach (Filter lr in p.RootFilters)
                    FilterTree.Nodes.Add(create_tree(lr, 0));
                foreach (TreeNode tn in FilterTree.Nodes)
                    tn.ExpandAll();

                //find default filter chain and check it
                if (FilterTree.Nodes.Count > 0)
                {
                    TreeNode tn = FilterTree.Nodes[0];
                    for (; tn.FirstNode != null; tn = tn.FirstNode) ;
                    tn.Checked = true;
                }

                string tree_name = filter_tree_xml_file;
                tree_name = tree_name.Substring(tree_name.LastIndexOf("\\") + 1);
                if (tree_name.EndsWith("." + Program.FilterTreeFileExtension, StringComparison.InvariantCultureIgnoreCase))
                    tree_name = tree_name.Substring(0, tree_name.LastIndexOf("."));
                FilterTreeName.Text = tree_name;
                FilterTreeFileDir.Text = Path.GetDirectoryName(filter_tree_xml_file) + @"\";
                FilterTreeFileDir.SelectionStart = FilterTreeFileDir.Text.Length;
                FilterTreeFileDir.ScrollToCaret();
                Settings.Default.LastFilterTreeFile = filter_tree_xml_file;
                Settings.Default.Save();
            }
            catch (Exception e)
            {
                Message.Error(e);
            }
        }