/// <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)); }
/// <summary> /// Handles the <see cref="IBackgroundTaskSet.TaskSetCompleted"/> event of a task set. /// </summary> /// <remarks> /// This displays the confirmation message. /// </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 TaskSet_TaskSetCompleted(object sender, TaskSetCompletedEventArgs e) { if (InvokeRequired) { Invoke((Action<object, TaskSetCompletedEventArgs>)TaskSet_TaskSetCompleted, sender, e); return; } lstRunningTaskSets.Remove((IBackgroundTaskSet)sender); ((IBackgroundTaskSet)sender).TaskStarted -= TaskSet_TaskStarted; ((IBackgroundTaskSet)sender).TaskSetCompleted -= TaskSet_TaskSetCompleted; if (!String.IsNullOrEmpty(e.Message)) { if (e.Success) MessageBox.Show(this, e.Message, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show(this, e.Message, "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <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; }
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()); } }
/// <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); }
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; }
/// <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); }
/// <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); }
/// <summary> /// Handles the <see cref="IBackgroundTaskSet.TaskSetCompleted"/> event of a task set. /// </summary> /// <remarks> /// This signals the wait handle that is blocking the initialization thread, allowing it to continue /// with the initialization. /// </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 TaskSet_TaskSetCompleted(object sender, TaskSetCompletedEventArgs e) { m_areTaskWait.Set(); }
/// <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); }