Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Cant make global variable show up after Navigation.PushModalAsync

$
0
0

The global variable doesnt show up after login is successful, however it shows up when i refresh the page.

(Class)

  public static class Login_information
    {
        public static int Global_login_id;
        public static string User_Firstname ;
        public static string User_Lastname; 
    }

(Loginpage)

private void Button_Pressed(object sender, EventArgs e)
{
     if (Password_input.Text == item.Password)
            {
                DisplayAlert("Login success", "Successfull login", "OK");
                Navigation.PushModalAsync(new NavigationBarPage());
                Login_information.Global_login_id = item.Id;
                Login_information.User_Firstname = item.FirstName;
                Login_information.User_Lastname = item.LastName;

            }
}

(Profilepage)

  public ProfilePage()
        {


            InitializeComponent();
            Update();
            Login_name.Text = Login_information.User_Firstname + " " + Login_information.User_Lastname;


        }

Viewing all articles
Browse latest Browse all 77050

Trending Articles