-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathLoadingTreeNode.cs
42 lines (36 loc) · 1.37 KB
/
LoadingTreeNode.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Windows.Forms;
namespace ReportSync
{
/// <summary>
/// A node to signify that the parent hasn't been loaded yet.
/// </summary>
/// <remarks>
/// The user will see "...loading..." while the children are being loaded. This node is then deleted.
/// </remarks>
public class LoadingTreeNode : TreeNode
{
private readonly string ssrsPath;
public LoadingTreeNode(string ssrsPath)
{
this.ssrsPath = ssrsPath;
this.Text = Properties.Resources.TreeNodeLoading;
}
public string SsrsPath { get { return this.ssrsPath; } }
/// <summary>
/// Tries to get the child <see cref="LoadingTreeNode"/>.
/// </summary>
/// <param name="treeNode">The parent tree node.</param>
/// <param name="loadingTreeNode">The loading tree node, if any.</param>
/// <returns><c>true</c> if the <paramref name="treeNode"/> had a <see cref="LoadingTreeNode"/>.</returns>
public static bool TryGetLoadingNode(TreeNode treeNode, out LoadingTreeNode loadingTreeNode)
{
if ((treeNode.Nodes.Count == 1) && (treeNode.Nodes[0] is LoadingTreeNode))
{
loadingTreeNode = (LoadingTreeNode)treeNode.Nodes[0];
return true;
}
loadingTreeNode = null;
return false;
}
}
}