using InABox.Core; using System; namespace Comal.Classes { public interface IBaseDimensions { double Quantity { get; set; } double Length { get; set; } double Width { get; set; } double Height { get; set; } double Weight { get; set; } } public interface IDimensions : IBaseDimensions { IDimensionUnit Unit { get; } IDimensionUnit GetUnit(); double Value { get; set; } String UnitSize { get; set; } void Set(IDimensionUnit unit, double quantity, double length, double width, double height, double weight); void CopyFrom(IDimensions source, bool observing = false); public void Calculate(object? quantity, object? length, object? width, object? height, object? weight, string? formula, string? format) { if (Dimensions.Evaluate(formula, quantity, length, width, height, weight, out double value)) Value = value; if (Dimensions.Evaluate(format, quantity, length, width, height, weight, out string unitsize)) UnitSize = unitsize; } public void CalculateValueAndUnitSize() { this.Calculate(Quantity, Length, Width, Height, Weight, Unit.Formula, Unit.Format); } } }