Ejemplo n.º 1
0
        private void ApplyFilterBtn_Click(object sender, RoutedEventArgs e)
        {
            if (fileNodeList.Count > 0)
            {
                if (filterText != "")
                {
                    if (regexEnabled)
                    {
                        try
                        {
                            filterRegex = new Regex(filterText);
                        }
                        catch (Exception reEx)
                        {
                            if (CNMode)
                            {
                                PrintLog("错误: 不正确的正则表达式");
                            }
                            else
                            {
                                PrintLog("Error: Incorrect regular expression.");
                            }
                            filterRegex          = null;
                            FilterBox.Foreground = System.Windows.Media.Brushes.Red;
                        }

                        fileNodeList[0].filterChildren(filterRegex);
                    }
                    else
                    {
                        fileNodeList[0].filterChildren(filterText);
                    }
                }
                else
                {
                    fileNodeList[0].resetVisibility();
                }
                FileTree.Focus();
            }
        }