share db
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Billing.Languages;
|
||||
using Billing.Models;
|
||||
using Billing.Store;
|
||||
using Billing.Themes;
|
||||
using Billing.UI;
|
||||
using Xamarin.Essentials;
|
||||
using Xamarin.Forms;
|
||||
|
||||
@@ -27,7 +30,7 @@ namespace Billing
|
||||
InitResources();
|
||||
|
||||
MainPage = new MainShell();
|
||||
Shell.Current.GoToAsync("//Splash");
|
||||
//Shell.Current.GoToAsync("//Splash");
|
||||
}
|
||||
|
||||
protected override void OnStart()
|
||||
@@ -36,7 +39,7 @@ namespace Billing
|
||||
Helper.Debug($"cache folder: {StoreHelper.CacheFolder}");
|
||||
}
|
||||
|
||||
internal static async Task InitilalizeData()
|
||||
internal static async Task InitializeData()
|
||||
{
|
||||
await Task.WhenAll(
|
||||
Task.Run(async () => accounts = await StoreHelper.GetAccountsAsync()),
|
||||
@@ -79,5 +82,33 @@ namespace Billing
|
||||
// TODO: status bar
|
||||
Resources = instance;
|
||||
}
|
||||
|
||||
public static bool OpenUrl(Uri uri)
|
||||
{
|
||||
if (uri == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
var absolute = uri.AbsolutePath;
|
||||
var url = System.Net.WebUtility.UrlDecode(absolute);
|
||||
if (File.Exists(url))
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
var result = await StoreHelper.ReloadDatabase(url);
|
||||
//if (result)
|
||||
{
|
||||
await InitializeData();
|
||||
|
||||
var current = Shell.Current.CurrentPage;
|
||||
if (current is BillingPage page)
|
||||
{
|
||||
MainThread.BeginInvokeOnMainThread(() => page.TriggerRefresh());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user