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

LoadTreeImages() private method

Loads the images for each node in a permanent loop
private LoadTreeImages ( ) : void
return void
		private void LoadTreeImages() {
			//return;
			while (true) {
				this._ResetEvent.WaitOne();
				Thread.Sleep(1);
				Application.DoEvents();
				var handle = imagesQueue.Dequeue();
				TreeNode node = null;
				IntPtr treeHandle = IntPtr.Zero;
				//var hash = -1;
				var pidl = IntPtr.Zero;
				var visible = false;
				this.ShellTreeView?.BeginInvoke((Action)(() => {
					node = TreeNode.FromHandle(ShellTreeView, handle);
					treeHandle = ShellTreeView.Handle;
					if (node != null) {
						visible = node.IsVisible;
						pidl = (node.Tag as IListItemEx).AbsolutePidl;
					}
				}));

				if (visible) {
					var nodeHandle = handle;
					//Thread.Sleep(1);
					//Application.DoEvents();

					SetNodeImage(nodeHandle, pidl, treeHandle, !(node.Parent != null && (node.Parent.Tag as IListItemEx).ParsingName == KnownFolders.Links.ParsingName));
				}
			}
		}