diff --git a/ucalc/Constants.cs b/ucalc/Constants.cs index d850bf3..c44ebbc 100644 --- a/ucalc/Constants.cs +++ b/ucalc/Constants.cs @@ -2,6 +2,7 @@ using System.Collections.Immutable; using System.Linq; using System.Windows.Media; +using UCalc.Controls; using UCalc.Data; namespace UCalc @@ -11,9 +12,15 @@ namespace UCalc public static readonly SolidColorBrush MainColor = Brushes.White; public static readonly SolidColorBrush SubMainColor = new SolidColorBrush(Color.FromRgb(0x00, 0x7A, 0xCC)); - public const string DecimalFormat = "0.00"; + public const int InternalPrecision = 6; + public const int DisplayPrecision = 2; public const string DateFormat = "dd.MM.yyyy"; + public static readonly string InternalPrecisionFormat = + Helpers.PrecisionToFormat(InternalPrecision, InternalPrecision - 2); + + public static readonly string DisplayPrecisionFormat = Helpers.PrecisionToFormat(DisplayPrecision); + public static readonly ImmutableList SalutationStrs = ((Salutation[]) Enum.GetValues(typeof(Salutation))).Select(value => value.AsString()).ToImmutableList(); diff --git a/ucalc/Controls/Helpers.cs b/ucalc/Controls/Helpers.cs index c3cfab3..bc974e7 100644 --- a/ucalc/Controls/Helpers.cs +++ b/ucalc/Controls/Helpers.cs @@ -37,5 +37,10 @@ namespace UCalc.Controls { return start1.IsBetween(start2, end2) || start2.IsBetween(start1, end1); } + + public static string PrecisionToFormat(int precision, int optional = 0) + { + return $"0.{new string('0', precision - optional)}{new string('#', optional)}"; + } } } \ No newline at end of file diff --git a/ucalc/CostEntryDetailsWindow.xaml b/ucalc/CostEntryDetailsWindow.xaml new file mode 100644 index 0000000..d098d48 --- /dev/null +++ b/ucalc/CostEntryDetailsWindow.xaml @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + +