/// <summary> /// Modifies the process thread data. /// </summary> /// <param name="handler">The handler.</param> /// <param name="remove">if set to <c>true</c> [remove].</param> private void ModifyProcessThreadData(ProcessThreadDataHandler <T> handler, bool remove) { try { lock (_lockEvents) { if (!remove) { this.ProcessThreadData += handler; } else { this.ProcessThreadData -= handler; } } LogManager.WriteLog(string.Format("|::> ProcessThreadData event was successfully {0}.", (remove ? "removed" : "added")), LogManager.enumLogLevel.Info); } catch (Exception ex) { ExceptionManager.Publish(ex); } }
/// <summary> /// Removes the process thread data. /// </summary> /// <param name="handler">The handler.</param> public void RemoveProcessThreadData(ProcessThreadDataHandler <T> handler) { this.ModifyProcessThreadData(handler, true); }
/// <summary> /// Adds the process thread data. /// </summary> /// <param name="handler">The handler.</param> public void AddProcessThreadData(ProcessThreadDataHandler <T> handler) { this.ModifyProcessThreadData(handler, false); }