示例#1
0
        private async void CheckLoggedInAsync()
        {
            try
            {
                var res = LoginUser.LoadUserAndIP(App.DatabaseLocation);
                if (res)
                {
                    var User             = Helpers.Constants.User;
                    var functionResponse = UserValidator.CheckUser(User);

                    //if (functionResponse.status == "error")
                    //{
                    //    DependencyService.Get<IMessage>().ShortAlert(functionResponse.Message);
                    //}
                    //else
                    //{
                    //    var response = await LoginConnection.CheckAccessAsync(User);
                    //    if (response.ToLower() == "success")
                    //    {
                    //        Helpers.Data.MenuItemsList = MenuItemsAccess.LoadList(App.DatabaseLocation);
                    //        MainPage = new NavigationPage(new HomePage());
                    //    }
                    //    else
                    //    {
                    //        DependencyService.Get<IMessage>().ShortAlert(functionResponse.Message);
                    //        MainPage = new LoginPage();
                    //    }

                    MainPage = new LoginPage();

                    //}
                }
                else
                {
                    MainPage = new LoginPage();
                }
            }
            catch (Exception ex)
            {
                DependencyService.Get <IMessage>().ShortAlert(ex.Message);
                MainPage = new LoginPage();
            }
        }