Example #1
0
 private void ChildrenOperationChanged(object sender, XPCollectionChangedEventArgs e)
 {
     if (View.CurrentObject is MaintenanceOperation operation &&
         e.CollectionChangedType.OneOf(XPCollectionChangedType.AfterAdd, XPCollectionChangedType.AfterRemove))
     {
         PersistentCalculatedTool.Mark(operation, nameof(operation.TotalCost));
         PersistentCalculatedTool.Mark(operation, nameof(operation.Duration));
     }
 }
Example #2
0
 public override void OnChanged(MaterialRequirement obj, string propertyName, object oldValue, object newValue)
 {
     base.OnChanged(obj, propertyName, oldValue, newValue);
     if (obj.IsLoading)
     {
         return;
     }
     if (propertyName.OneOf(nameof(MaterialRequirement.Material), nameof(MaterialRequirement.Amount)))
     {
         obj.Cost = CalculateCost(obj);
     }
     if (propertyName.Equals(nameof(MaterialRequirement.Cost)))
     {
         PersistentCalculatedTool.MarkAndCalculate(obj.Operation, nameof(MaintenanceOperation.TotalCost));
     }
 }
Example #3
0
 public override void OnChanged(MaintenanceOperation obj, string propertyName, object oldValue, object newValue)
 {
     base.OnChanged(obj, propertyName, oldValue, newValue);
     if (obj.IsLoading)
     {
         return;
     }
     if (propertyName.Equals(nameof(MaintenanceOperation.Duration)))
     {
         if (obj.Parent != null)
         {
             PersistentCalculatedTool.MarkAndCalculate(obj.Parent, nameof(MaintenanceOperation.Duration));
         }
     }
     if (propertyName.Equals(nameof(MaintenanceOperation.WorkCost)))
     {
         obj.CalculateCost();
     }
 }
Example #4
0
 public override void BeforeDeleting(MaterialRequirement obj)
 {
     base.BeforeDeleting(obj);
     PersistentCalculatedTool.MarkAndCalculate(obj.Operation, nameof(MaintenanceOperation.TotalCost));
 }
Example #5
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo)
 {
     base.CustomizeTypesInfo(typesInfo);
     CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);
     PersistentCalculatedTool.Initialize <MaintenanceOperation>();
 }