コード例 #1
0
        private void SearchNextNode()
        {
            if (_searchState == null)
            {
                return;
            }

            SearchWorker worker = new SearchWorker(_searchState);

            Thread t = new Thread(new ThreadStart(worker.Run));

            t.IsBackground = true;
            t.Start();

            _searchForm = new CancelSearchForm();
            if (_searchForm.ShowDialog(this) == DialogResult.Cancel)
            {
                worker.Cancel();
                _searchState = null;

                UpdateUI();
            }

            t.Join();
        }
コード例 #2
0
        private void SearchNode(TreeNode node)
        {
            if (node == null || !(node.Tag is DataNode))
            {
                return;
            }

            DataNode dataNode = node.Tag as DataNode;

            if (!dataNode.CanSearchNode)
            {
                return;
            }

            Find form = new Find();

            if (form.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            _searchState = new SearchStateWin(this)
            {
                RootNode         = dataNode,
                SearchName       = form.NameToken,
                SearchValue      = form.ValueToken,
                DiscoverCallback = SearchDiscoveryCallback,
                CollapseCallback = SearchCollapseCallback,
                EndCallback      = SearchEndCallback,
            };

            SearchNextNode();
        }
コード例 #3
0
        public void SearchEndCallback(DataNode node)
        {
            if (_searchForm != null)
            {
                _searchForm.DialogResult = DialogResult.OK;
                _searchForm = null;
            }

            _searchState = null;
            UpdateUI();

            MessageBox.Show("End of results");
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: emps2222/NBTExplorer
        private void SearchNextNode()
        {
            if (_searchState == null)
                return;

            SearchWorker worker = new SearchWorker(_searchState);

            Thread t = new Thread(new ThreadStart(worker.Run));
            t.IsBackground = true;
            t.Start();

            _searchForm = new CancelSearchForm();
            if (_searchForm.ShowDialog(this) == DialogResult.Cancel) {
                worker.Cancel();
                _searchState = null;
            }

            t.Join();
        }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: emps2222/NBTExplorer
        private void SearchNode(TreeNode node)
        {
            if (node == null || !(node.Tag is DataNode))
                return;

            DataNode dataNode = node.Tag as DataNode;
            if (!dataNode.CanSearchNode)
                return;

            Find form = new Find();
            if (form.ShowDialog() != DialogResult.OK)
                return;

            _searchState = new SearchStateWin(this) {
                RootNode = dataNode,
                SearchName = form.NameToken,
                SearchValue = form.ValueToken,
                DiscoverCallback = SearchDiscoveryCallback,
                CollapseCallback = SearchCollapseCallback,
                EndCallback = SearchEndCallback,
            };

            SearchNextNode();
        }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: DMV-Jumbo/NBTExplorer
        public void SearchEndCallback (DataNode node)
        {
            if (_searchForm != null) {
                _searchForm.DialogResult = DialogResult.OK;
                _searchForm = null;
            }

            _searchState = null;
            UpdateUI();

            MessageBox.Show("End of results");
        }