public void CallUpdateBottomBarFeedback(ModActivationMonitorListViewItem p_ActivateModList)
 {
     UpdateBottomBarFeedback(p_ActivateModList, new EventArgs());
 }
        /// <summary>
        /// Adds the given <see cref="BasicInstallTask"/> to the view's list. If the <see cref="BasicInstallTask"/>
        /// already exists in the list, nothing is done.
        /// </summary>
        /// <param name="p_tskTask">The <see cref="BasicInstallTask"/> to add to the view's list.</param>
        protected void AddTaskToList(IBackgroundTaskSet p_tskTask)
        {
            foreach (ModActivationMonitorListViewItem lviExisitingTask in lvwActiveTasks.Items)
            {
                if (lviExisitingTask.Task == p_tskTask)
                {
                    return;
                }
            }

            if (ViewModel.RunningTask != null)
            {
                if (p_tskTask.GetType() == typeof(ModInstaller))
                {
                    foreach (IBackgroundTaskSet iBk in QueuedTasks)
                    {
                        if (iBk.GetType() == typeof(ModInstaller))
                        {
                            if (((ModInstaller)iBk).ModFileName == ((ModInstaller)p_tskTask).ModFileName)
                            {
                                if (((ModInstaller)iBk).IsQueued)
                                {
                                    booQueued = true;
                                }
                            }
                        }
                        else if (iBk.GetType() == typeof(ModUninstaller))
                        {
                            if (((ModUninstaller)iBk).ModFileName == ((ModInstaller)p_tskTask).ModFileName)
                            {
                                if (((ModUninstaller)iBk).IsQueued)
                                {
                                    booQueued = true;
                                }
                            }
                        }
                        else if (iBk.GetType() == typeof(ModUpgrader))
                        {
                            if (((ModUpgrader)iBk).ModFileName == ((ModInstaller)p_tskTask).ModFileName)
                            {
                                if (((ModUpgrader)iBk).IsQueued)
                                {
                                    booQueued = true;
                                }
                            }
                        }
                    }

                    if (ViewModel.RunningTask.GetType() == typeof(ModInstaller))
                    {
                        if ((((ModInstaller)ViewModel.RunningTask).ModFileName == ((ModInstaller)p_tskTask).ModFileName) || booQueued)
                        {
                            booQueued = false;
                            m_vmlViewModel.RemoveUselessTask(((ModInstaller)p_tskTask));
                            return;
                        }
                    }
                    else if (ViewModel.RunningTask.GetType() == typeof(ModUpgrader))
                    {
                        if ((((ModUpgrader)ViewModel.RunningTask).ModFileName == ((ModInstaller)p_tskTask).ModFileName) || booQueued)
                        {
                            booQueued = false;
                            m_vmlViewModel.RemoveUselessTask(((ModInstaller)p_tskTask));
                            return;
                        }
                    }
                }
                else if (p_tskTask.GetType() == typeof(ModUninstaller))
                {
                    foreach (IBackgroundTaskSet iBk in QueuedTasks)
                    {
                        if (iBk.GetType() == typeof(ModInstaller))
                        {
                            if (((ModInstaller)iBk).ModFileName == ((ModUninstaller)p_tskTask).ModFileName)
                            {
                                if (((ModInstaller)iBk).IsQueued)
                                {
                                    booQueued = true;
                                }
                            }
                        }
                        else if (iBk.GetType() == typeof(ModUninstaller))
                        {
                            if (((ModUninstaller)iBk).ModFileName == ((ModUninstaller)p_tskTask).ModFileName)
                            {
                                if (((ModUninstaller)iBk).IsQueued)
                                {
                                    booQueued = true;
                                }
                            }
                        }
                        else if (iBk.GetType() == typeof(ModUpgrader))
                        {
                            if (((ModUpgrader)iBk).ModFileName == ((ModUninstaller)p_tskTask).ModFileName)
                            {
                                if (((ModUpgrader)iBk).IsQueued)
                                {
                                    booQueued = true;
                                }
                            }
                        }
                    }

                    if (ViewModel.RunningTask.GetType() == typeof(ModUninstaller))
                    {
                        if ((((ModUninstaller)ViewModel.RunningTask).ModFileName == ((ModUninstaller)p_tskTask).ModFileName) || booQueued)
                        {
                            booQueued = false;
                            m_vmlViewModel.RemoveUselessTaskUn(((ModUninstaller)p_tskTask));
                            return;
                        }
                    }
                    else if (ViewModel.RunningTask.GetType() == typeof(ModUpgrader))
                    {
                        if ((((ModUpgrader)ViewModel.RunningTask).ModFileName == ((ModUninstaller)p_tskTask).ModFileName) || booQueued)
                        {
                            booQueued = false;
                            m_vmlViewModel.RemoveUselessTaskUn(((ModUninstaller)p_tskTask));
                            return;
                        }
                    }
                }
                else if (p_tskTask.GetType() == typeof(ModUpgrader))
                {
                    foreach (IBackgroundTaskSet iBk in QueuedTasks)
                    {
                        if (iBk.GetType() == typeof(ModInstaller))
                        {
                            if (((ModInstaller)iBk).ModFileName == ((ModUpgrader)p_tskTask).ModFileName)
                            {
                                if (((ModInstaller)iBk).IsQueued)
                                {
                                    booQueued = true;
                                }
                            }
                        }
                        else if (iBk.GetType() == typeof(ModUninstaller))
                        {
                            if (((ModUninstaller)iBk).ModFileName == ((ModUpgrader)p_tskTask).ModFileName)
                            {
                                if (((ModUninstaller)iBk).IsQueued)
                                {
                                    booQueued = true;
                                }
                            }
                        }
                        else if (iBk.GetType() == typeof(ModUpgrader))
                        {
                            if (((ModUpgrader)iBk).ModFileName == ((ModUpgrader)p_tskTask).ModFileName)
                            {
                                if (((ModUpgrader)iBk).IsQueued)
                                {
                                    booQueued = true;
                                }
                            }
                        }
                    }

                    if (ViewModel.RunningTask.GetType() == typeof(ModInstaller))
                    {
                        if ((((ModInstaller)ViewModel.RunningTask).ModFileName == ((ModUpgrader)p_tskTask).ModFileName) || booQueued)
                        {
                            booQueued = false;
                            m_vmlViewModel.RemoveUselessTaskUpg(((ModUpgrader)p_tskTask));
                            return;
                        }
                    }
                    else if (ViewModel.RunningTask.GetType() == typeof(ModUninstaller))
                    {
                        if ((((ModUninstaller)ViewModel.RunningTask).ModFileName == ((ModUpgrader)p_tskTask).ModFileName) || booQueued)
                        {
                            booQueued = false;
                            m_vmlViewModel.RemoveUselessTaskUpg(((ModUpgrader)p_tskTask));
                            return;
                        }
                    }
                    else if (ViewModel.RunningTask.GetType() == typeof(ModUpgrader))
                    {
                        if ((((ModUpgrader)ViewModel.RunningTask).ModFileName == ((ModUpgrader)p_tskTask).ModFileName) || booQueued)
                        {
                            booQueued = false;
                            m_vmlViewModel.RemoveUselessTaskUpg(((ModUpgrader)p_tskTask));
                            return;
                        }
                    }
                }
            }

            p_tskTask.TaskSetCompleted += new EventHandler <TaskSetCompletedEventArgs>(TaskSet_TaskSetCompleted);
            ModActivationMonitorListViewItem lviActivation = new ModActivationMonitorListViewItem(p_tskTask, this);

            UpdateBottomBarFeedback(lviActivation, new EventArgs());
            lvwActiveTasks.Items.Add(lviActivation);

            try
            {
                lviActivation.EnsureVisible();
            }
            catch { }

            if ((ViewModel.RunningTask == null) || (ViewModel.RunningTask.IsCompleted))
            {
                ViewModel.RunningTask = p_tskTask;
                if (ViewModel.RunningTask.GetType() == typeof(ModInstaller))
                {
                    ((ModInstaller)ViewModel.RunningTask).Install();
                }
                else if (ViewModel.RunningTask.GetType() == typeof(ModUninstaller))
                {
                    ((ModUninstaller)ViewModel.RunningTask).Install();
                }
                else if (ViewModel.RunningTask.GetType() == typeof(ModUpgrader))
                {
                    ((ModUpgrader)ViewModel.RunningTask).Install();
                }
            }
            else
            {
                QueuedTasks.Add(p_tskTask);
            }
        }