/// <summary>
        /// Checks all Mods from the ModSelection.
        /// </summary>
        public static void CheckAllMods()
        {
            Messenger.AddDebug(Messages.MSG_CHECKING_ALL_MODS);

            EventDistributor.InvokeAsyncTaskStarted(Instance);
            View.SetEnabledOfAllControls(false);

            int maxCount = Mods.Length;
            View.SetProgressBarStates(true, maxCount, 0);

            int count = 0;
            AsyncTask<bool> asyncJob = new AsyncTask<bool>();
            asyncJob.SetCallbackFunctions(
                () =>
                {
                    foreach (ModNode mod in Mods)
                    {
                        Messenger.AddDebug(string.Format(Messages.MSG_CHECKING_MOD_0, mod.Name));
                        asyncJob.ProgressChanged(null, new ProgressChangedEventArgs(++count, null));
                        View.InvokeIfRequired(() => { mod.Checked = true; });
                    }

                    return true;
                },
                (result, ex) =>
                {
                    EventDistributor.InvokeAsyncTaskDone(Instance);
                    View.SetEnabledOfAllControls(true);
                    View.SetProgressBarStates(false);

                    InvalidateView();

                    if (ex != null)
                        Messenger.AddError(string.Format(Messages.MSG_ERROR_DURING_REFRESH_CHECKED_STATE_0, ex.Message), ex);
                },
                (processedCount) =>
                {
                    View.SetProgressBarStates(true, maxCount, processedCount);
                });
            asyncJob.Run();
        }
        /// <summary>
        /// Traversing the complete tree and renews the checked state of all nodes.
        /// </summary>
        protected static void RefreshCheckedState(ModNode mod, ref int processedCount, AsyncTask<bool> asyncJob = null)
        {
            try
            {
                processedCount += 1;
                if (asyncJob != null)
                    asyncJob.ProgressChanged(null, new ProgressChangedEventArgs(processedCount, null));

                bool isInstalled = false;
                NodeType nodeType = NodeType.UnknownFolder;

                if (!mod.HasDestination)
                {
                    isInstalled = false;
                    nodeType = (mod.IsFile) ? NodeType.UnknownFile : NodeType.UnknownFolder;
                }
                else
                {
                    isInstalled = mod.IsInstalled = mod.IsModNodeInstalled();

                    if (mod.IsFile)
                    {
                        ////value = File.Exists(KSPPathHelper.GetDestinationPath(mod));
                        nodeType = (isInstalled) ? NodeType.UnknownFileInstalled : NodeType.UnknownFile;
                    }
                    else
                    {
                        ////bool isInstalled = Directory.Exists(KSPPathHelper.GetDestinationPath(mod));
                        bool hasInstalledChilds = mod.HasInstalledChilds;

                        bool isKSPDir = false;
                        isKSPDir = KSPPathHelper.IsKSPDir(KSPPathHelper.GetAbsolutePath(mod));

                        if (isKSPDir)
                        {
                            isInstalled = (isInstalled && hasInstalledChilds);
                            nodeType = (isInstalled) ? NodeType.KSPFolderInstalled : NodeType.KSPFolder;
                        }
                        else
                        {
                            isInstalled = (isInstalled || hasInstalledChilds);
                            nodeType = (isInstalled) ? NodeType.UnknownFolderInstalled : NodeType.UnknownFolder;
                        }
                    }
                }

                View.InvokeIfRequired(() =>
                {
                    mod._Checked = isInstalled;
                    mod.NodeType = nodeType;
                });
            }
            catch (Exception ex)
            {
                mod._Checked = false;
                Messenger.AddError(string.Format(Messages.MSG_ERROR_DURING_REFRESH_CHECKED_STATE_0, ex.Message), ex);
            }

            foreach (ModNode child in mod.Nodes)
                RefreshCheckedState(child, ref processedCount, asyncJob);
        }