Пример #1
0
 /// <summary>
 /// Handles the <see cref="IBackgroundTaskSet.TaskSetCompleted"/> event of the mod deletion
 /// mod deativator.
 /// </summary>
 /// <param name="sender">The object that raised the event.</param>
 /// <param name="e">A <see cref="TaskSetCompletedEventArgs"/> describing the event arguments.</param>
 private void Deactivator_TaskSetCompleted(object sender, TaskSetCompletedEventArgs e)
 {
     if (e.Success)
     {
         ManagedModRegistry.UnregisterMod((IMod)e.ReturnValue);
     }
 }
Пример #2
0
        /// <summary>
        /// Handles the <see cref="IBackgroundTaskSet.TaskSetCompleted"/> event of script executors.
        /// </summary>
        /// <remarks>
        /// This unwires our listeners from the executor.
        /// </remarks>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">A <see cref="TaskSetCompletedEventArgs"/> describing the event arguments.</param>
        private void ScriptExecutor_TaskSetCompleted(object sender, TaskSetCompletedEventArgs e)
        {
            IBackgroundTaskSet btsExecutor = (IBackgroundTaskSet)sender;

            btsExecutor.TaskStarted      -= ScriptExecutor_TaskStarted;
            btsExecutor.TaskSetCompleted -= ScriptExecutor_TaskSetCompleted;
        }
Пример #3
0
        private void TaskSet_TaskSetCompleted(object sender, TaskSetCompletedEventArgs e)
        {
            m_btsRunningTask = null;

            if (QueuedTasks.Count > 0)
            {
                m_btsRunningTask = QueuedTasks.First();
                QueuedTasks.Remove(m_btsRunningTask);
                if (m_btsRunningTask.GetType() == typeof(ModInstaller))
                {
                    ((ModInstaller)m_btsRunningTask).Install();
                }
                else if (m_btsRunningTask.GetType() == typeof(ModUninstaller))
                {
                    ((ModUninstaller)m_btsRunningTask).Install();
                }
                else if (m_btsRunningTask.GetType() == typeof(ModUpgrader))
                {
                    ((ModUpgrader)m_btsRunningTask).Install();
                }
            }
            else
            if (EmptyQueue != null)
            {
                EmptyQueue(this, new EventArgs());
            }
        }
        private void TaskSet_TaskSetCompleted(object sender, TaskSetCompletedEventArgs e)
        {
            if ((ListView != null) && ListView.InvokeRequired)
            {
                ListView.Invoke((Action <IBackgroundTaskSet, TaskSetCompletedEventArgs>)TaskSet_TaskSetCompleted, sender, e);
                return;
            }

            bool   booComplete          = false;
            bool   booSuccess           = false;
            string strPopupErrorMessage = string.Empty;

            booSuccess = e.Success;

            ModInstallerBase mibModInstaller;

            try
            {
                mibModInstaller = (ModInstallerBase)sender;
                booComplete     = mibModInstaller.IsCompleted;
                if (mibModInstaller.PopupErrorMessage != string.Empty)
                {
                    strPopupErrorMessage = mibModInstaller.PopupErrorMessage;
                }
            }
            catch { }

            if (booComplete)
            {
                if (strPopupErrorMessage != string.Empty)
                {
                    SubItems["?"].Text = strPopupErrorMessage;
                }

                if (!booSuccess)
                {
                    SubItems["Status"].Text   = e.Message;
                    SubItems["Progress"].Text = "";
                }
                else
                {
                    SubItems["Status"].Text   = "Complete";
                    SubItems["Progress"].Text = "100%";
                }
            }
            else
            {
                SubItems["Status"].Text   = e.Message;
                SubItems["Progress"].Text = "";
            }

            m_amcControl.CallUpdateBottomBarFeedback(this);

            m_booRemovable = true;
        }
Пример #5
0
        /// <summary>
        /// Raises the <see cref="IBackgroundTaskSet.TaskSetCompleted"/> event.
        /// </summary>
        /// <remarks>
        /// This changes the message to reflect that fact that we are deleting the mod.
        /// </remarks>
        /// <param name="e">A <see cref="TaskSetCompletedEventArgs"/> describing the event arguments.</param>
        protected override void OnTaskSetCompleted(TaskSetCompletedEventArgs e)
        {
            string strMessage = null;

            if (e.Success)
            {
                DeleteModFile((IMod)e.ReturnValue);
            }
            else
            {
                strMessage = "Could not delete mod.";
            }
            base.OnTaskSetCompleted(new TaskSetCompletedEventArgs(e.Success, strMessage, e.ReturnValue));
        }
Пример #6
0
        private void TaskSet_TaskSetCompleted(object sender, TaskSetCompletedEventArgs e)
        {
            if ((ListView != null) && ListView.InvokeRequired)
            {
                ListView.Invoke((Action <IBackgroundTaskSet, TaskSetCompletedEventArgs>)TaskSet_TaskSetCompleted, sender, e);
                return;
            }

            bool booComplete = false;
            bool booSuccess  = false;

            IBackgroundTaskSet btsExecutor = (IBackgroundTaskSet)sender;

            booSuccess = e.Success;
            if (btsExecutor.GetType() == typeof(ModInstaller))
            {
                booComplete = ((ModInstaller)btsExecutor).IsCompleted;
            }
            else if (btsExecutor.GetType() == typeof(ModUninstaller))
            {
                booComplete = ((ModUninstaller)btsExecutor).IsCompleted;
            }
            else if (btsExecutor.GetType() == typeof(ModUpgrader))
            {
                booComplete = ((ModUpgrader)btsExecutor).IsCompleted;
            }

            if (booComplete)
            {
                if (!booSuccess)
                {
                    SubItems["Status"].Text   = e.Message;
                    SubItems["Progress"].Text = "";
                }
                else
                {
                    SubItems["Status"].Text   = "Complete";
                    SubItems["Progress"].Text = "100%";
                }
            }
            else
            {
                SubItems["Status"].Text   = e.Message;
                SubItems["Progress"].Text = "";
            }


            m_booRemovable = true;
        }
        private void TaskSet_TaskSetCompleted(object sender, TaskSetCompletedEventArgs e)
        {
            ModInstallerBase mibModInstaller;

            try
            {
                mibModInstaller              = (ModInstallerBase)sender;
                m_strPopupErrorMessage       = mibModInstaller.PopupErrorMessage;
                m_strPopupErrorMessageType   = mibModInstaller.PopupErrorMessageType;
                m_strDetailsErrorMessageType = mibModInstaller.DetailsErrorMessage;
            }
            catch { }

            IBackgroundTaskSet btsCompletedTask = null;

            if (sender != null)
            {
                btsCompletedTask = (IBackgroundTaskSet)sender;
            }

            if ((ViewModel.RunningTask == null) || (ViewModel.RunningTask == btsCompletedTask))
            {
                ViewModel.RunningTask = null;

                if (QueuedTasks.Count > 0)
                {
                    ViewModel.RunningTask = QueuedTasks.First();
                    QueuedTasks.Remove(ViewModel.RunningTask);
                    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
                if (EmptyQueue != null)
                {
                    EmptyQueue(this, new EventArgs());
                }
            }
        }
Пример #8
0
 /// <summary>
 /// Raises the <see cref="TaskSetCompleted"/> event.
 /// </summary>
 /// <remarks>
 /// The event is raised asynchronously, so the installer can continue its work uninterrupted.
 /// This is to prevent deadlocks, primarily on the UI thread.
 /// </remarks>
 /// <param name="e">A <see cref="TaskSetCompletedEventArgs"/> describing the task that was started.</param>
 protected virtual void OnTaskSetCompleted(TaskSetCompletedEventArgs e)
 {
     IsCompleted = true;
     m_ewhSetCompleted.Set();
     ((Action <TaskSetCompletedEventArgs>)RaiseTaskSetCompleted).BeginInvoke(e, EndTaskSetCompletedCallback, null);
 }
Пример #9
0
 /// <summary>
 /// Raises the <see cref="TaskSetCompleted"/> event.
 /// </summary>
 /// <param name="e">A <see cref="TaskSetCompletedEventArgs"/> describing the task that was started.</param>
 private void RaiseTaskSetCompleted(TaskSetCompletedEventArgs e)
 {
     TaskSetCompleted(this, e);
 }
Пример #10
0
 /// <summary>
 /// Raises the <see cref="TaskSetCompleted"/> event.
 /// </summary>
 /// <param name="e">A <see cref="TaskSetCompletedEventArgs"/> describing the task that was started.</param>
 protected virtual void OnTaskSetCompleted(TaskSetCompletedEventArgs e)
 {
     IsCompleted = true;
     m_ewhSetCompleted.Set();
     TaskSetCompleted(this, e);
 }