2016-05-02 09:52:09 +03:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using Bit.App.Abstractions;
|
2016-05-03 00:50:16 +03:00
|
|
|
|
using Bit.App.Pages;
|
2016-05-02 09:52:09 +03:00
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Bit.App
|
|
|
|
|
{
|
|
|
|
|
public class App : Application
|
|
|
|
|
{
|
|
|
|
|
private readonly IDatabaseService _databaseService;
|
2016-05-03 00:50:16 +03:00
|
|
|
|
private readonly IAuthService _authService;
|
2016-05-02 09:52:09 +03:00
|
|
|
|
|
|
|
|
|
public App(IAuthService authService, IDatabaseService databaseService)
|
|
|
|
|
{
|
|
|
|
|
_databaseService = databaseService;
|
2016-05-03 00:50:16 +03:00
|
|
|
|
_authService = authService;
|
2016-05-02 09:52:09 +03:00
|
|
|
|
|
|
|
|
|
if(authService.IsAuthenticated)
|
|
|
|
|
{
|
2016-05-03 00:50:16 +03:00
|
|
|
|
MainPage = new MainPage();
|
2016-05-02 09:52:09 +03:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2016-05-03 00:50:16 +03:00
|
|
|
|
MainPage = new LoginNavigationPage();
|
2016-05-02 09:52:09 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MainPage.BackgroundColor = Color.FromHex("ecf0f5");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnStart()
|
|
|
|
|
{
|
|
|
|
|
// Handle when your app starts
|
|
|
|
|
_databaseService.CreateTables();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnSleep()
|
|
|
|
|
{
|
|
|
|
|
// Handle when your app sleeps
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnResume()
|
|
|
|
|
{
|
|
|
|
|
// Handle when your app resumes
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|