private void RaiseFirstUpdatingProgress(TaskPlugin plugin, string currentTaskToken) { UpdatingTaskProgressEventArgs e = new UpdatingTaskProgressEventArgs(TaskState.Updating); e.TaskToken = currentTaskToken; e.Parameters.Add("Name", plugin.Name); e.Parameters.Add("Description", plugin.Description); OnUpdatingProgress(e); }
/// <summary> /// Raises the <see cref="E:UpdatingProgress" /> event. /// </summary> /// <param name="e">The <see cref="UpdatingTaskProgressEventArgs" /> instance containing the event data.</param> protected void OnUpdatingProgress(UpdatingTaskProgressEventArgs e) { EventHandler <UpdatingTaskProgressEventArgs> handler = UpdatingProgressInternal; if (handler != null) { handler(null, e); } }
/// <summary> /// Raises the <see cref="E:UpdatingProgress" /> event. /// </summary> /// <param name="e">The <see cref="UpdatingTaskProgressEventArgs" /> instance containing the event data.</param> protected virtual void OnUpdatingProgress(UpdatingTaskProgressEventArgs e) { var handler = UpdatingProgress; if (handler != null) { handler(this, e); if (e.TaskState == TaskState.Canceled) { isCanceled = true; } } }
private static void TryUpdateProgress(UpdatingTaskProgressEventArgs e) { try { if (receiver != null) { receiver.UpdateProgress(e); } } catch { receiver = null; } }
private void task_UpdatingProgress(object sender, UpdatingTaskProgressEventArgs e) { e.TaskToken = taskToken; while (currentTaskCommand == TaskCommand.Pause) { TryUpdateProgress(e); Thread.Sleep(500); } TryUpdateProgress(e); if (currentTaskCommand == TaskCommand.Cancel) { e.TaskState = TaskState.Canceled; } }
private void Task_UpdatingProgress(object sender, UpdatingTaskProgressEventArgs e) { var currentTaskPlugin = (TaskPlugin)sender; var inProcessTaskInformation = inProcessTaskInformations.FirstOrDefault(p => p.TaskPlugin.Equals(currentTaskPlugin)); if (inProcessTaskInformation != null) { if (inProcessTaskInformation.TaskCommand == TaskCommand.Cancel) { e.TaskState = TaskState.Canceled; } e.TaskToken = inProcessTaskInformation.TaskToken; } UpdateProgressCore(e); }
/// <summary> /// Runs this instance. /// </summary> public void Run() { UpdatingTaskProgressEventArgs args = new UpdatingTaskProgressEventArgs(TaskState.Updating); OnUpdatingProgress(args); try { RunCore(); } catch (Exception e) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, e.Message, new ExceptionInfo(e)); args.Error = new ExceptionInfo(e.Message, e.StackTrace, e.Source); isCanceled = true; } finally { args.TaskState = isCanceled ? TaskState.Canceled : TaskState.Completed; OnUpdatingProgress(args); } }
void ITaskCallbackReceiver.UpdateProgress(UpdatingTaskProgressEventArgs e) { UpdateProgressCore(e); }
/// <summary> /// Updates the progress core. /// </summary> /// <param name="e">The <see cref="UpdatingTaskProgressEventArgs" /> instance containing the event data.</param> protected virtual void UpdateProgressCore(UpdatingTaskProgressEventArgs e) { OnUpdatingProgress(e); }