Example #1
0
        public App()
        {
            ViewModel = new InAppViewModel();
            ViewModel.RestoreState(Current.Properties);

            MainPage = new RootPage();
        }
Example #2
0
        public App()
        {
            ViewModel = new InAppViewModel();
            ViewModel.RestoreState(Current.Properties);

            MainPage = new RootPage();
        }
Example #3
0
        public App()
        {
            InitializeComponent();
            // ViewModel.RestoreState(Current.Properties);

            App.ViewModel = new InAppViewModel();

            ConnectionInfo info     = StorageManager.GetConnectionInfo();
            Settings       settings = info.Settings;

            if (settings.Lang == 0)
            {
                MainPage = new LanguagesPage();
            }
            else if (settings.LastLoggedIn != 0)
            {//TODO weight, goal
                if (info.LoginUser.HeightType == -1 || info.LoginUser.Height == -1 || info.LoginUser.Gender == -1 || info.LoginUser.Weight == 0 || info.LoginUser.Goal == 0)
                {
                    MainPage = new LoginProcessPage();
                }
                else
                {
                    int days = (int)(info.LoginUser.LastWeightDate - DateTime.Now).TotalDays;
                    if (settings.RemindWeight < days)
                    {
                        var notifier = DependencyService.Get <ICrossLocalNotifications>().CreateLocalNotifier();
                        notifier.Notify(new LocalNotification()
                        {
                            Title      = "Weight Reminder",
                            Text       = "It has been " + days + " days since you last entered your weight.",
                            Id         = 33,
                            NotifyTime = DateTime.Now,
                        });
                    }
                    MainPage = new MainPage();
                }
            }
            else
            {
                MainPage = new LoginPage();//StartPage
            }
        }