diff --git a/Billing.Shared/App.cs b/Billing.Shared/App.cs index dc9cd94..cc0fd7f 100644 --- a/Billing.Shared/App.cs +++ b/Billing.Shared/App.cs @@ -13,6 +13,7 @@ namespace Billing { public class App : Application { + internal const string NewBillAction = "/newbill"; private const string SaveLocationKey = nameof(SaveLocationKey); public static AppTheme CurrentTheme { get; private set; } @@ -21,17 +22,27 @@ namespace Billing public static List Accounts => accounts ??= new List(); public static List Categories => categories ??= new List(); public static bool SaveLocation => saveLocation; + public static string MainRoute => mainRoute; private static List bills; private static List accounts; private static List categories; private static bool saveLocation; + private static string mainRoute; private string initialUrl; public App(string url = null) { - initialUrl = url; + if (url == NewBillAction) + { + mainRoute = "//Bills/Details"; + } + else + { + mainRoute = "//Bills"; + initialUrl = url; + } CurrentCulture = new PlatformCulture(); InitResources(); diff --git a/Billing.Shared/MainShell.xaml.cs b/Billing.Shared/MainShell.xaml.cs index 8146bcc..d571a06 100644 --- a/Billing.Shared/MainShell.xaml.cs +++ b/Billing.Shared/MainShell.xaml.cs @@ -1,3 +1,4 @@ +using Billing.Views; using Xamarin.Forms; namespace Billing @@ -6,6 +7,8 @@ namespace Billing { public MainShell() { + Routing.RegisterRoute("Bills/Details", typeof(AddBillPage)); + InitializeComponent(); } } diff --git a/Billing.Shared/SplashPage.xaml.cs b/Billing.Shared/SplashPage.xaml.cs index 1533529..0837cb4 100644 --- a/Billing.Shared/SplashPage.xaml.cs +++ b/Billing.Shared/SplashPage.xaml.cs @@ -14,7 +14,7 @@ namespace Billing { await App.InitializeData(); - await Shell.Current.GoToAsync("//Bills"); + await Shell.Current.GoToAsync(App.MainRoute); } } } diff --git a/Billing.Shared/Store/StoreHelper.cs b/Billing.Shared/Store/StoreHelper.cs index 7457b32..c115d50 100644 --- a/Billing.Shared/Store/StoreHelper.cs +++ b/Billing.Shared/Store/StoreHelper.cs @@ -38,6 +38,7 @@ namespace Billing.Store catch (Exception ex) { Helper.Error("database.close", ex); + return false; } try { @@ -54,12 +55,13 @@ namespace Billing.Store SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.SharedCache); + return true; } catch (Exception ex) { Helper.Error("database.connect", ex); + return false; } - return true; } public static readonly AsyncLazy Instance = new(async () => diff --git a/Billing.Shared/Views/AddBillPage.xaml.cs b/Billing.Shared/Views/AddBillPage.xaml.cs index 480ace3..6b328ec 100644 --- a/Billing.Shared/Views/AddBillPage.xaml.cs +++ b/Billing.Shared/Views/AddBillPage.xaml.cs @@ -70,6 +70,7 @@ namespace Billing.Views private CancellationTokenSource tokenSource; private Location location; + public AddBillPage() : this(DateTime.Today) { } public AddBillPage(DateTime date) { createDate = date; diff --git a/Billing.Shared/Views/RankPage.xaml b/Billing.Shared/Views/RankPage.xaml index e53e388..7797798 100644 --- a/Billing.Shared/Views/RankPage.xaml +++ b/Billing.Shared/Views/RankPage.xaml @@ -13,25 +13,24 @@ Shell.TabBarIsVisible="True"> - + - - - +