complete account page

This commit is contained in:
2022-03-02 17:31:49 +08:00
parent aa38e186c7
commit 51f8e4f2e8
26 changed files with 547 additions and 76 deletions

View File

@ -1,5 +1,7 @@
using Billing.Languages;
using Billing.Models;
using Billing.Themes;
using Billing.Views;
using System;
using System.Collections.Generic;
using System.Globalization;
@ -20,18 +22,23 @@ namespace Billing.UI
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
throw new NotImplementedException();
}
}
public class MoneyConverter : IValueConverter
{
public bool MarkVisible { get; set; } = true;
public bool Absolute { get; set; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is decimal d)
{
if (Absolute)
{
d = Math.Abs(d);
}
var number = d.ToString("n2");
if (MarkVisible)
{
@ -60,6 +67,46 @@ namespace Billing.UI
}
}
public class BalanceColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var resource = Application.Current.Resources;
if (value is decimal d)
{
if (d >= 0)
{
return resource[BaseTheme.GreenColor];
}
return resource[BaseTheme.RedColor];
}
return resource[BaseTheme.TextColor];
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public class UIBillConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is UIBill bill)
{
var time = bill.DateCreation.ToString("HH:mm");
return $"{time} ({bill.Wallet})";
}
return string.Empty;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public class NotNullConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
@ -69,7 +116,7 @@ namespace Billing.UI
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
throw new NotImplementedException();
}
}
@ -93,7 +140,7 @@ namespace Billing.UI
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
throw new NotImplementedException();
}
}
@ -151,7 +198,7 @@ namespace Billing.UI
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
throw new NotImplementedException();
}
}
}