private void Finished(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Error != null)
{
this.actualNode.Status = LoadingStatus.REQUEST_FAILURE;
}
else if (e.Cancelled)
{
this.actualNode.Status = LoadingStatus.ABORTED;
}
else
{
this.actualNode.Status = LoadingStatus.DONE;
List<Node> children = e.Result as List<Node>;
MergeFolderTrees(this.actualNode, children);
foreach (Node oldChild in this.actualNode.Children)
{
try
{
Node newChild = children.First(x => x.Name.Equals(oldChild.Name));
}
catch (InvalidOperationException)
{
// this node exists locally or is ignored, mark it as <code>LoadingStatus.DONE</code>
SetNodeTreeStatus(oldChild, LoadingStatus.DONE);
}
}
}
UpdateNodeEvent ();
Load();
}