当前位置: 首页>>代码示例>>C#>>正文


C# TreeView.Invoke方法代码示例

本文整理汇总了C#中System.Windows.Forms.TreeView.Invoke方法的典型用法代码示例。如果您正苦于以下问题:C# TreeView.Invoke方法的具体用法?C# TreeView.Invoke怎么用?C# TreeView.Invoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.TreeView的用法示例。


在下文中一共展示了TreeView.Invoke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InvokeAddNode

 /// <summary>
 /// Invoke方式添加TreeView的Node
 /// </summary>
 public static void InvokeAddNode(TreeView treeView, TreeNode node)
 {
     if (treeView.InvokeRequired)
     {
         treeView.Invoke(new MethodInvoker(() => { InvokeAddNode(treeView, node); }));
     }
     else
     {
         treeView.Nodes.Add(node);
     }
 }
开发者ID:yienit,项目名称:KST,代码行数:14,代码来源:UIInvokeUtil.cs

示例2: AddNode

        public static void AddNode(TreeView treeview, TreeNode node)
        {
            MethodInvoker mi = delegate
            {
                treeview.Nodes.Add(node);
            };

            if (treeview.InvokeRequired)
            {
                treeview.Invoke(mi);
            }
            else
            {
                mi();
            }
        }
开发者ID:NielsMinnee,项目名称:XrmToolBox,代码行数:16,代码来源:TreeViewDelegates.cs

示例3: ExpandAll

        public static void ExpandAll(TreeView treeview)
        {
            MethodInvoker mi = delegate
            {
                treeview.ExpandAll();
            };

            if (treeview.InvokeRequired)
            {
                treeview.Invoke(mi);
            }
            else
            {
                mi();
            }
        }
开发者ID:NielsMinnee,项目名称:XrmToolBox,代码行数:16,代码来源:TreeViewDelegates.cs

示例4: ClearNodes

        public static void ClearNodes(TreeView treeview)
        {
            MethodInvoker mi = delegate
            {
                treeview.Nodes.Clear();
            };

            if (treeview.InvokeRequired)
            {
                treeview.Invoke(mi);
            }
            else
            {
                mi();
            }
        }
开发者ID:NielsMinnee,项目名称:XrmToolBox,代码行数:16,代码来源:TreeViewDelegates.cs

示例5: GetSelectedNode

        public static TreeNode GetSelectedNode(TreeView treeview)
        {
            TreeNode node = null;

            MethodInvoker mi = delegate
            {
                node = treeview.SelectedNode;
            };

            if (treeview.InvokeRequired)
                treeview.Invoke(mi);
            else
                mi();

            return node;
        }
开发者ID:NielsMinnee,项目名称:XrmToolBox,代码行数:16,代码来源:TreeViewDelegates.cs

示例6: GetNodes

        public static TreeNodeCollection GetNodes(TreeView treeview)
        {
            TreeNodeCollection collection = null;

            MethodInvoker mi = delegate
            {
                collection = treeview.Nodes;
            };

            if (treeview.InvokeRequired)
            {
                treeview.Invoke(mi);
            }
            else
            {
                mi();
            }

            return collection;
        }
开发者ID:NielsMinnee,项目名称:XrmToolBox,代码行数:20,代码来源:TreeViewDelegates.cs

示例7: Sort

        public static void Sort(TreeView treeview, IComparer nodeSorter)
        {
            MethodInvoker mi = delegate
            {
                treeview.TreeViewNodeSorter = nodeSorter;
                treeview.Sort();
            };

            if (treeview.InvokeRequired)
            {
                treeview.Invoke(mi);
            }
            else
            {
                mi();
            }
        }
开发者ID:NielsMinnee,项目名称:XrmToolBox,代码行数:17,代码来源:TreeViewDelegates.cs

示例8: ClearTreeNodes

 private void ClearTreeNodes(TreeView treeView)
 {
     if (this.InvokeRequired)
     {
         ClearTreeNodesDelegate d = new ClearTreeNodesDelegate(ClearTreeNodes);
         treeView.Invoke(d, treeView);
     }
     else
     {
         treeView.Nodes.Clear();
     }
 }
开发者ID:riskypathak,项目名称:WebSpider,代码行数:12,代码来源:Form1.cs

示例9: ImportDataCard

        private void ImportDataCard(string datacardPath, string initializeString, TreeView treeView)
        {
            _treeView = treeView;

            Task.Run(() =>
            {
                _updateStatusAction(CurrentState, "Starting Import");

                ApplicationDataModels = _dataProvider.Import(datacardPath, initializeString);
                if (ApplicationDataModels == null || ApplicationDataModels.Count == 0)
                {
                    MessageBox.Show(@"Not supported data format.");
                    CurrentState = State.StateIdle;
                    _updateStatusAction(CurrentState, "Done");
                    return;
                }

                _admIndex = 0;
                for (; _admIndex < ApplicationDataModels.Count; _admIndex++)
                {
                    var applicationDataModel = ApplicationDataModels[_admIndex];

                    applicationDataModel.Documents.LoggedData.SelectMany(x => x.OperationData.ToList()).ToList();
                    
                    var parentNode = (TreeNode)_treeView.Invoke(new Func<TreeNode>(() => treeView.Nodes.Add("ApplicationDataModel")));

                    AddNode(applicationDataModel, parentNode);
                }
                
                CurrentState = State.StateIdle;
                _updateStatusAction(CurrentState, "Done");
                
            });

            
        }
开发者ID:tarakreddy,项目名称:ADAPT,代码行数:36,代码来源:Model.cs

示例10: PopulateChildTree

 public void PopulateChildTree(TreeView tree,TestTreeNodeFacade facade)
 {
     foreach(TreeTestDomain td in this.list)
     {
         UnitTreeNode node = this.factory.CreateUnitTreeNode(
             td.TestTree.ParentNode.Name,
             TestNodeType.Populator,
             td.Identifier,
             td.TestTree.ParentNode.Identifier
             );
         tree.Invoke(new AddNodeDelegate(tree.Nodes.Add),new Object[]{node});
         td.PopulateChildTree(node,facade);
     }
 }
开发者ID:BackupTheBerlios,项目名称:mbunit-svn,代码行数:14,代码来源:TreeTestDomainCollection.cs

示例11: ConnectCompleted

        static void ConnectCompleted(SSBIServer serv, Server srv, TreeView tv, TreeNode tn, bool success, string msg)
        {
            if (tv.InvokeRequired) {
            tv.Invoke(new ConnectCompletedDelegate(ConnectCompleted), new object[] { serv, srv, tv, tn, success, msg });
              }
              else {

            try {
              if (success) {
            serv.HasLoggedIn = true;
            serv.SMOServer = srv;
            serv.IsTryingToConnect = false;
            tn.Tag = serv;
            if (tn == tv.SelectedNode) {
              tn.Expand();
            }
              }
              else {
            MessageBox.Show(msg);
              }

            }

            catch (FailedOperationException fe) {
              smo.ShowException(fe);

            }

            catch (Exception e) {
              smo.ShowException(e);

            }

            finally {
              //connNode = null;
              tn.ForeColor = Color.Black;
              //toolStripStatusLabel1.Text = "Ready!";
              serv.IsTryingToConnect = false;
              tn.Tag = serv;
              tn.Text = serv.Name;
            }

              }
        }
开发者ID:nberglund,项目名称:ssbadmin,代码行数:44,代码来源:TreeViewStuff.cs

示例12: _GetNodesFromFuncAndPostToTreeView

 // Dont call this one!!
 private void _GetNodesFromFuncAndPostToTreeView(List<string> exts, TreeView tv)
 {
     TreeNode tr = null;
     ParameterizedThreadStart starter = new ParameterizedThreadStart(obj => PopulateRootTreeFiles(exts, ref tr));
     Thread process = new Thread(starter);
     process.Start();
     process.Join();
     tv.Invoke(new Action<TreeNode, TreeView>(InsertNodeIntoTree), new object[] {tr, tv});
 }
开发者ID:rLinks234,项目名称:nUtility,代码行数:10,代码来源:MainWindow.cs

示例13: ClearTreeViewNodes

 public void ClearTreeViewNodes(TreeView tv)
 {
     if (tv.InvokeRequired)
     {
         tv.Invoke(new Action<TreeView>(ClearTreeViewNodes), new object[] {tv});
     }
     else
     {
         tv.Nodes.Clear();
     }
 }
开发者ID:rLinks234,项目名称:nUtility,代码行数:11,代码来源:MainWindow.cs

示例14: DeleteTreeRootNode

 private void DeleteTreeRootNode(TreeView treeView, TreeNode tNode)
 {
     if (this.InvokeRequired)
     {
         DeleteTreeRootNodeDelegate d = new DeleteTreeRootNodeDelegate(DeleteTreeRootNode);
         treeView.Invoke(d, treeView, tNode);
     }
     else
     {
         treeView.Nodes.Remove(tNode);
     }
 }
开发者ID:riskypathak,项目名称:WebSpider,代码行数:12,代码来源:Form1.cs

示例15: loadTreeViewWithDirectoriesAndFiles

        public static void loadTreeViewWithDirectoriesAndFiles(TreeView tvTargetTreeView, String sDirectoryToProcess,
                                                               String sFileFilter, TextBox tbCurrentLoadedDirectory,
                                                               bool bShowFileSize, bool hideFiles)
        {
            try
            {
                if (tvTargetTreeView.InvokeRequired)
                    tvTargetTreeView.Invoke(
                        new EventHandler(
                            delegate
                                {
                                    loadTreeViewWithDirectoriesAndFiles(tvTargetTreeView, sDirectoryToProcess,
                                                                        sFileFilter, tbCurrentLoadedDirectory,
                                                                        bShowFileSize, hideFiles);
                                }));
                else
                {
                    if (sDirectoryToProcess != "")
                    {
                        tvTargetTreeView.Visible = false;
                        tvTargetTreeView.Nodes.Clear();
                        String sPreviousDirectory = Path.GetFullPath(Path.Combine(sDirectoryToProcess, ".."));
                        if (Directory.Exists(sPreviousDirectory))
                            tvTargetTreeView.Nodes.Add(newTreeNode("..", sPreviousDirectory, 2, sPreviousDirectory));

                        foreach (String sDirectory in Directory.GetDirectories(sDirectoryToProcess))
                        {
                            tvTargetTreeView.Nodes.Add(newTreeNode(Path.GetFileName(sDirectory), sDirectory, 0,
                                                                   sDirectory));
                        }

                        foreach (String sFile in Directory.GetFiles(sDirectoryToProcess, sFileFilter))
                        {
                            if (hideFiles)
                            {
                                var newNode = newTreeNode(Path.GetFileName(sFile), null, 1, null);
                                newNode.ForeColor = Color.Gray;
                                tvTargetTreeView.Nodes.Add(newNode);
                            }
                            else
                            {
                                if (bShowFileSize)
                                    tvTargetTreeView.Nodes.Add(
                                        newTreeNode(
                                            String.Format("{0}     :     {1}k", Path.GetFileName(sFile),
                                                          Files.getFileSize(Path.Combine(sDirectoryToProcess, sFile)) / 1024),
                                            sFile, 1, sFile));
                                else
                                    tvTargetTreeView.Nodes.Add(newTreeNode(Path.GetFileName(sFile), sFile, 1, sFile));
                            }
                        }
                        tvTargetTreeView.Visible = true;

                        //   if (null != lCurrentLoadedDirectory)
                        //       lCurrentLoadedDirectory.Text = Path.GetFileName(sDirectoryToProcess);
                    }
                    else
                        PublicDI.log.error(
                            "in loadTreeViewWithDirectoriesAndFiles, sDirectoryToProcess != \"\", this value must be provided");
                }               
            }
            catch (Exception ex)
            {
                PublicDI.log.error("in loadTreeViewWithDirectoriesAndFiles: {0}", ex.Message);
            }
        }
开发者ID:pusp,项目名称:o2platform,代码行数:66,代码来源:O2Forms.cs


注:本文中的System.Windows.Forms.TreeView.Invoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。