internal void DoUpdate(Task task) { try { Debug.Print("DeriveBehaviour - {0} - {1} - processing task \"{2}\"", isCustomColumn ? customColumnName : defaultColumnType.ToString(), expression, task.Name); var expressionValue = mInfo.Invoke(null, new object[] { task }); if (isCustomColumn) { // Ensure that we get the custom column of the right project var customColumn = task.ProjectView.GetCustomColumn(customColumnName); var oldValue = task.GetCustomColumnValue(customColumnName); if (customColumn != null && oldValue != null && !oldValue.Equals(expressionValue)) task.SetCustomColumnValue(customColumn, expressionValue); } else { var oldValue = task.GetDefaultColumnValue(defaultColumnType); if (oldValue != null && !oldValue.Equals(expressionValue)) task.SetDefaultColumnValue(defaultColumnType, expressionValue); } } catch (TargetInvocationException e) { // Hack to let column handlers bail out when they don't have any new value to set. if (!(e.InnerException is NoNewValueException)) throw; } }
internal void Apply(Task task) { if (isCustomColumn) task.SetCustomColumnValue(customColumn, defaultValue); else { task.SetDefaultColumnValue(defaultColumnType, defaultValue); } }
internal void DoUpdate(Task task) { object expressionValue = mInfo.Invoke(null, new object[] { task }); if (isCustomColumn) { // Ensure that we get the custom column of the right project HPMProjectCustomColumnsColumn actualCustomColumn = task.ProjectView.GetCustomColumn(customColumnName); if (actualCustomColumn != null) task.SetCustomColumnValue(actualCustomColumn, expressionValue); } else task.SetDefaultColumnValue(defaultColumnType, expressionValue); }