Exemplo n.º 1
0
 public App()
 {
     InitializeComponent();
     if (MobileServiceUsers.GetCredentials())
     {
         MainPage = new NavigationBar();
         return;
     }
     MainPage = new Login();
 }
Exemplo n.º 2
0
        private async void BtnLogin(object sender, EventArgs e)
        {
            var res = await MobileServiceUsers.LoginUserAsync(new Users()
            {
                UserName = users.Users.UserName, Password = users.Users.Password
            });

            if (res)
            {
                Application.Current.MainPage = new Navigation.NavigationBar();
            }
            else
            {
                users.Users.UserName = "";
                users.Users.Password = "";
                await DisplayAlert("Invalid Credentials", "Check username and password", "Ok");
            }
        }
Exemplo n.º 3
0
        private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var item = e.SelectedItem as NavigationBarMenuItem;

            if (item == null)
            {
                return;
            }
            if (item.Title == "Logout")
            {
                MobileServiceUsers.Logout();
                Application.Current.MainPage = new Login();
                return;
            }

            var page = (Page)Activator.CreateInstance(item.TargetType);

            page.Title = item.Title;

            Detail      = new NavigationPage(page);
            IsPresented = false;

            MasterPage.ListView.SelectedItem = null;
        }