Beispiel #1
0
        /// <summary>
        /// 通过控件ID号来查找对应的页面,并记录相关跳转信息
        /// </summary>
        /// <param oldName="id">控件ID</param>
        private void findID(int id)
        {
            _findView.Clear();
            _findView.AppendText("---------------查找结果如下:-----------------\n");
            _findView.AppendText("\n");

            foreach (SVPageNode pageNode in _treeView.Nodes)
            {
                foreach (TreeNode classItem in pageNode.Nodes)
                {
                    foreach (SVPageNode item in classItem.Nodes)
                    {
                        SVPageWidget widget = item.Addtionobj as SVPageWidget;
                        if (widget == null)
                        {
                            continue;
                        }

                        if (widget.Attrib.id == id)
                        {
                            String text = String.Format("找到名为【{0}】的页面, id:{1}", widget.PageName, id);
                            _findView.AppendText(text);
                            _findView.setMark(widget);
                            _findView.AppendText("\n");
                        }

                        foreach (var panel in widget.Controls)
                        {
                            SVPanel p = panel as SVPanel;
                            if (p == null)
                            {
                                continue;
                            }

                            if (p.Id == id)
                            {
                                String text = String.Format("名为【{0}】的页面中, 找到控件====>类型【{1}】.", widget.PageName, p.GetType().Name);
                                _findView.AppendText(text);
                                _findView.setMark(p);
                                _findView.AppendText("\n");
                            }
                        }
                    }
                }
            }

            if (!_findView.isMatches())
            {
                _findView.AppendText("没有查找到相关内容!");
            }
        }
Beispiel #2
0
        /// <summary>
        /// 输出查找结果
        /// </summary>
        /// <param oldName="panel">当前控件</param>
        /// <param oldName="vStr">当前判断的字符串</param>
        void outputFindResult(SVPanel panel, String vStr)
        {
            SVPageWidget widget = panel.Parent as SVPageWidget;

            if (widget == null)
            {
                return;
            }

            ///查找的字符串是否为空
            String findString = textBox.Text;

            if (String.IsNullOrWhiteSpace(findString))
            {
                return;
            }

            ///字符串
            String findStr = findString;
            String oldStr  = vStr;

            ///是否大小写匹配
            if (caseCheckBox.Checked)
            {
                findStr = findStr.ToLower();
                oldStr  = oldStr.ToLower();
            }

            ///全字匹配
            if (wholeCheckBox.Checked)
            {
                if (findStr == oldStr)
                {
                    String text = String.Format("页面【{0}】中, 找到控件====>类型【{1}】.", widget.PageName, panel.GetType().Name);
                    _findView.AppendText(text);
                    _findView.setMark(panel);
                    _findView.AppendText("\n");
                }
            }
            else
            {
                if (oldStr.Contains(findStr))
                {
                    String text = String.Format("页面【{0}】中, 找到控件====>类型【{1}】.", widget.PageName, panel.GetType().Name);
                    _findView.AppendText(text);
                    _findView.setMark(panel);
                    _findView.AppendText("\n");
                }
            }
        }