Example #1
0
        public App()
        {
            InitializeComponent();

            //Crear o cargar las tablas de base de datos a partir de los modelos
            connection = new SQLiteAsyncConnection(Cfg.Database);

            connection.CreateTableAsync <Profile>().Wait();
            connection.CreateTableAsync <Chat>().Wait();
            connection.CreateTableAsync <Contact>().Wait();
            connection.CreateTableAsync <Message>().Wait();
            connection.CreateTableAsync <Configuration>().Wait();

            if (configurationDAO.isEmpty())
            {
                MainPage = new InitView();
                configurationDAO.Insert(new Configuration(1));
            }
            else
            {
                if (profileDAO.isEmpty())
                {
                    MainPage = new LoginView {
                        BindingContext = new LoginViewModel
                        {
                            LoginSendDTO = new LoginSendDTO()
                        }
                    };
                }
                else
                {
                    MainPage = new NavigationPage(new MainView());
                }
            }
        }