BExplorer.Shell.ShellTreeViewEx.RequestLoadChilds C# (CSharp) Method

RequestLoadChilds() private method

private RequestLoadChilds ( IntPtr handle ) : void
handle System.IntPtr
return void
		private void RequestLoadChilds(IntPtr handle) {
			new Thread(() => {
				//Application.DoEvents();
				//Thread.Sleep(1);
				//this._ResetEvent.WaitOne();
				TreeNode node = null;
				IntPtr treeHandle = IntPtr.Zero;
				var visible = true;
				//var pidl = IntPtr.Zero;
				this.ShellTreeView?.BeginInvoke((Action)(() => {
					node = TreeNode.FromHandle(ShellTreeView, handle);
					treeHandle = this.ShellTreeView.Handle;
					if (node != null)
						visible = node.IsVisible;
				}));

				if (!visible)
					return;

				//if (node != null && node.Nodes.Count > 0)
				if (node?.Nodes?.Count > 0) {
					var childItem = node.Nodes[0];
					if (childItem != null) {
						//TODO: Try to remove this Try Catch! It's slowing this down!!
						try {
							var sho = (node.Tag as IListItemEx);
							if (!sho.HasSubFolders)
								User32.SendMessage(treeHandle, MSG.TVM_DELETEITEM, 0, childItem.Handle);

							this.CheckedFroChilds.Add(handle);
						}
						catch (Exception) {
						}
					}
				}
			}).Start();
		}