public ChangeTracker <T> CheckChanges( Func <T, object> selector, ChangeTypeEnum code) { CheckChangesWithPlanned(selector, null, code); return(this); }
public static void SetEulerAngles(this Transform @this, Vector3 newValue, ChangeTypeEnum changeTypeTransform, AxisCombined axisCombined = AxisCombined.XYZ) { if (@this) { Vector3 eulerAngles = @this.eulerAngles; @this.eulerAngles = Vector3Extend.ChangeVector(eulerAngles, newValue, changeTypeTransform, axisCombined); } }
public static void SetVelocity(this Rigidbody2D @this, Vector2 newValue, ChangeTypeEnum changeTypeTransform, Axis2DCombined axisCombined = Axis2DCombined.XY) { if (@this) { Vector3 velocity = @this.velocity; @this.velocity = Vector2Extend.ChangeVector(velocity, newValue, changeTypeTransform, axisCombined); } }
/// <summary>Init and get event instance</summary> public static BGCurveChangedArgs GetInstance(BGCurve curve, ChangeTypeEnum type, string message) { Instance.curve = curve; Instance.changeType = type; Instance.message = message; Instance.multipleChanges = null; Instance.point = null; return(Instance); }
public static void SetZEulerAngles(this Transform @this, float zValue, ChangeTypeEnum changeTypeTransform, Vector2 range = default) { if (@this) { Vector3 eulerAngles = @this.eulerAngles; eulerAngles = Vector3Extend.ChangeVector(eulerAngles, AxisCombined.Z, zValue, changeTypeTransform, range); @this.eulerAngles = eulerAngles; } }
public static void SetYVelocity(this Rigidbody2D @this, float yValue, ChangeTypeEnum changeTypeTransform, Vector2 range = default) { if (@this) { Vector3 velocity = @this.velocity; velocity = Vector2Extend.ChangeVector(velocity, Axis2DEnum.Y, yValue, changeTypeTransform, range); @this.velocity = velocity; } }
private void LogsForNewItem <TS>( ChangeTypeEnum added, Func <TS, IEnumerable <AuditLogEntry> > processorOfNew, TS entity) where TS : Identity { Logs = Logs.Append(LogAction(added, null, entity, false)); if (processorOfNew != null) { Logs = Logs.Concat(processorOfNew(entity)); } }
/// <summary> /// This method Item Changed /// </summary> public async void ItemChanged(object itemChanged, ChangeTypeEnum listChangeType) { // cast the item as a ToDo object Image image = itemChanged as Image; // If the image object exists if (NullHelper.Exists(image)) { // perform the saved bool saved = await ImageService.SaveImage(ref image); } }
/// <summary> /// This method Item Changed /// </summary> public async void ItemChanged(object itemChanged, ChangeTypeEnum listChangeType) { // cast the item as a ToDo object ToDo toDo = itemChanged as ToDo; // If the toDo object exists if (NullHelper.Exists(toDo)) { // perform the saved bool saved = await ToDoService.SaveToDo(ref toDo); } }
/// <summary> /// This method Item Changed /// </summary> public async void ItemChanged(object itemChanged, ChangeTypeEnum listChangeType) { // cast the item as a ToDo object Artist artist = itemChanged as Artist; // If the artist object exists if (NullHelper.Exists(artist)) { // perform the saved bool saved = await ArtistService.SaveArtist(ref artist); } }
/// <summary> /// This method Item Changed /// </summary> public async void ItemChanged(object itemChanged, ChangeTypeEnum listChangeType) { // cast the item as a ToDo object User user = itemChanged as User; // If the user object exists if (NullHelper.Exists(user)) { // perform the saved bool saved = await UserService.SaveUser(ref user); } }
private static AuditLogEntry LogAction(ChangeTypeEnum code, object origin, object updated, bool planned) { if (!ChangeTypeCodes.ContainsKey(code)) { throw new ArgumentException($"Change type {code} is not exist."); } return(new AuditLogEntry { Original = origin, NewValue = updated, ChangeType = $"{(int)code + 1} {ChangeTypeCodes[code]}", IsPlanned = planned }); }
/// <summary> /// Watches for changes of the given type to the Element with the given ID. When changed, executes /// the given Delegate. /// </summary> /// <param name="e">ID of the Element being watched.</param> /// <param name="type">Type of change to watch for.</param> /// <param name="d">Delegate to be called when changed.</param> public void RegisterChangeHook(ElementId e, ChangeTypeEnum type, DynElementUpdateDelegate d) { Dictionary <ElementId, DynElementUpdateDelegate> dict; if (!_updateDict.ContainsKey(type)) { dict = new Dictionary <ElementId, DynElementUpdateDelegate>(); _updateDict[type] = dict; } else { dict = _updateDict[type]; } dict[e] = d; }
private void SaveChange(ChangeTypeEnum pIntChangeType, T pObjEntity) { mObjContext.Change.Add(new Change() { Id = 0, ChangeType = pIntChangeType, ObjectType = typeof(T).Name, Object = GetSerializedObject(pObjEntity), Date = DateTime.Now, Protected = true, Removed = false, UserId = GetCurrentUserId(), CreationDate = DateTime.Now, ModificationDate = DateTime.Now }); }
public ChangeTracker <T> CheckChangesWithPlanned( Func <T, object> selector, Func <T, object> plannedSelector, ChangeTypeEnum code) { if (_original == null) { throw new InvalidOperationException("You can't use this method without origin."); } if (selector(_original).IsDeepEqual(selector(_updated))) { return(this); } bool planned = plannedSelector != null && !plannedSelector(_original).IsDeepEqual(plannedSelector(_updated)); Logs = Logs.Append(LogAction(code, selector(_original), selector(_updated), planned)); return(this); }
public static dynamic GetTSObject(ChangeTypeEnum dynEnum) { var tsType = TSActivator.CreateInstance("Tekla.Structures.Model.ChangeData.ChangeTypeEnum").GetType(); switch (dynEnum) { case ChangeTypeEnum.OBJECT_INSERT: return(System.Enum.Parse(tsType, "OBJECT_INSERT")); case ChangeTypeEnum.OBJECT_MODIFY: return(System.Enum.Parse(tsType, "OBJECT_MODIFY")); case ChangeTypeEnum.OBJECT_DELETE: return(System.Enum.Parse(tsType, "OBJECT_DELETE")); case ChangeTypeEnum.USERPROPERTY_CHANGED: return(System.Enum.Parse(tsType, "USERPROPERTY_CHANGED")); default: throw new DynamicAPIException(dynEnum.ToString() + "- enum value is not implemented"); } }
private void SaveChange(ChangeTypeEnum pIntChangeType, IList <T> pLstObjEntity) { if (pLstObjEntity != null && pLstObjEntity.Count > 0) { foreach (var lObjEntity in pLstObjEntity) { mObjContext.Change.Add(new Change() { Id = 0, ChangeType = pIntChangeType, ObjectType = lObjEntity.GetType().Name, Object = lObjEntity.CopyWithoutVirtualProperties().JsonSerialize(), Date = DateTime.Now, Protected = true, Removed = false, UserId = GetCurrentUserId(), CreationDate = DateTime.Now, ModificationDate = DateTime.Now }); } } }
private void SaveChange(ChangeTypeEnum pIntChangeType, T pObjEntity) { #if DEBUG var a = typeof(T).Name; var b = pObjEntity.CopyWithoutVirtualProperties().JsonSerialize(); var c = GetCurrentUserId(); #endif mObjContext.Change.Add(new Change() { Id = 0, ChangeType = pIntChangeType, ObjectType = typeof(T).Name, Object = pObjEntity.CopyWithoutVirtualProperties().JsonSerialize(), Date = DateTime.Now, Protected = true, Removed = false, UserId = GetCurrentUserId(), CreationDate = DateTime.Now, ModificationDate = DateTime.Now }); }
public ChangeTracker <T> CheckChangesInIdentityList <TS>( Func <T, List <TS> > selector, Func <TS, TS, IEnumerable <AuditLogEntry> > processor, ChangeTypeEnum added, Func <TS, IEnumerable <AuditLogEntry> > processorOfNew = null) where TS : Identity { var updated = selector(_updated) .GroupBy(x => x.Id) .ToDictionary(x => x.Key, x => x.FirstOrDefault()); if (_original == null) { foreach (var entity in updated.Values) { LogsForNewItem(added, processorOfNew, entity); } return(this); } var original = selector(_original) .GroupBy(x => x.Id) .ToDictionary(x => x.Key, x => x.FirstOrDefault()); foreach (var updatedKey in updated.Keys) { if (original.ContainsKey(updatedKey)) { Logs = Logs.Concat(processor(original[updatedKey], updated[updatedKey])); } else { var entity = updated[updatedKey]; LogsForNewItem(added, processorOfNew, entity); } } return(this); }
/// <summary> /// Unregisters an element that has been registered via RegisterChangeHook() /// </summary> /// <param name="e">ID of the Element to unregister.</param> /// <param name="type">Type of change to unsubscribe from.</param> public void UnRegisterChangeHook(ElementId e, ChangeTypeEnum type) { _updateDict[type].Remove(e); }
/// <summary> /// Unregisters an element that has been registered via RegisterChangeHook() /// </summary> /// <param name="e">ID of the Element to unregister.</param> /// <param name="type">Type of change to unsubscribe from.</param> public void UnRegisterChangeHook(ElementId e, ChangeTypeEnum type) { this.updateDict[type].Remove(e); }
/// <summary> /// Watches for changes of the given type to the Element with the given ID. When changed, executes /// the given Delegate. /// </summary> /// <param name="e">ID of the Element being watched.</param> /// <param name="type">Type of change to watch for.</param> /// <param name="d">Delegate to be called when changed.</param> public void RegisterChangeHook(ElementId e, ChangeTypeEnum type, DynElementUpdateDelegate d) { Dictionary<ElementId, DynElementUpdateDelegate> dict; if (!this.updateDict.ContainsKey(type)) { dict = new Dictionary<ElementId, DynElementUpdateDelegate>(); this.updateDict[type] = dict; } else dict = this.updateDict[type]; dict[e] = d; }
public BGCurveChangedArgs(BGCurve curve, BGCurveChangedArgs[] multipleChanges) { this.curve = curve; changeType = ChangeTypeEnum.Multiple; this.multipleChanges = multipleChanges; }
public BGCurveChangedArgs(BGCurve curve, BGCurvePoint point, ChangeTypeEnum changeType) : this(curve, changeType) { this.point = point; }
public BGCurveChangedArgs(BGCurve curve, ChangeTypeEnum changeType) { this.curve = curve; this.changeType = changeType; }