feature: save location

This commit is contained in:
2022-03-17 16:19:18 +08:00
parent b46b150f6a
commit 60f7824cb5
16 changed files with 216 additions and 60 deletions

View File

@ -11,10 +11,16 @@ namespace Billing.Views
public partial class SettingPage : BillingPage
{
private static readonly BindableProperty VersionProperty = Helper.Create<string, SettingPage>(nameof(Version));
private static readonly BindableProperty SaveLocationProperty = Helper.Create<bool, SettingPage>(nameof(SaveLocation));
private static readonly BindableProperty PrimaryColorProperty = Helper.Create<string, SettingPage>(nameof(PrimaryColor));
private static readonly BindableProperty ManyRecordsProperty = Helper.Create<string, SettingPage>(nameof(ManyRecords));
public string Version => (string)GetValue(VersionProperty);
public bool SaveLocation
{
get => (bool)GetValue(SaveLocationProperty);
set => SetValue(SaveLocationProperty, value);
}
public string PrimaryColor
{
get => (string)GetValue(PrimaryColorProperty);
@ -35,16 +41,14 @@ namespace Billing.Views
ShareLogsCommand = new Command(OnShareLogsCommand);
InitializeComponent();
var main = AppInfo.VersionString;
var build = AppInfo.BuildString;
SetValue(VersionProperty, $"{main} ({build})");
SetValue(VersionProperty, $"{AppInfo.VersionString} ({AppInfo.BuildString})");
}
protected override async void OnAppearing()
{
base.OnAppearing();
//SetValue(VersionProperty, $"{AppInfo.VersionString} ({AppInfo.BuildString})");
SaveLocation = App.SaveLocation;
var colorString = Preferences.Get(Definition.PrimaryColorKey, Helper.DEFAULT_COLOR);
PrimaryColor = Helper.WrapColorString(colorString);
@ -56,8 +60,8 @@ namespace Billing.Views
{
base.OnDisappearing();
App.SetSaveLocation(SaveLocation);
Preferences.Set(Definition.PrimaryColorKey, PrimaryColor);
//Light.Instance.RefreshColor(Color.FromHex(color));
}
protected override async void OnRefresh()