Example #1
0
        public App()
        {
            CurrentApp = this;
            InitializeComponent();

            //MainPage = new ChatPage(null);
            //return;

            RealmConfiguration realmConfiguration = RealmConfiguration.DefaultConfiguration;

            try
            {
                RealmInstance = Realm.GetInstance();
            }
            catch (RealmMigrationNeededException e)
            {
                try
                {
                    Realm.DeleteRealm(realmConfiguration);
                    //Realm file has been deleted.
                    RealmInstance = Realm.GetInstance(realmConfiguration);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }


            var eventos = App.CurrentApp.RealmInstance.All <Notificacion>().ToList();

            //MainPage = new NavigationPage(new GuanajovenCodePage());
            // return;

            if (PropertiesManager.IsFirstTime())
            {
                MainPage = new WelcomePage();
            }
            else
            {
                if (PropertiesManager.IsLogedIn())
                {
                    //	MainPage = new HomePage();
                    MainPage = new NavigationPage(new HomeDrawerPage());
                }
                else
                {
                    MainPage = new NavigationPage(new RootPage());
                    //MainPage = new NavigationPage(new HomeDrawerPage());
                    //	MainPage = new NavigationPage(new PickIdiomas());
                }
            }


            InitPushNotifications();
        }