public Login() { this.InitializeComponent(); KeyboardAccelerator GoBack = new KeyboardAccelerator(); GoBack.Key = Windows.System.VirtualKey.GoBack; GoBack.Invoked += BackInvoked; KeyboardAccelerator AltLeft = new KeyboardAccelerator(); AltLeft.Key = Windows.System.VirtualKey.Left; AltLeft.Invoked += BackInvoked; this.KeyboardAccelerators.Add(GoBack); this.KeyboardAccelerators.Add(AltLeft); // ALT routes here AltLeft.Modifiers = Windows.System.VirtualKeyModifiers.Menu; this._viewModel = new LoginFlightAttendant(); }
public async Task <bool> LogIn(string email, string password) { using (var client = new HttpClient()) { var model = new LoginFlightAttendant { UserName = email, Password = password }; string json = JsonConvert.SerializeObject(model); HttpContent httpContent = new StringContent(json, Encoding.UTF8, "application/json"); var httpResponse = await client.PostAsync(new Uri("https://localhost:44319/api/Auth/CrewLogin", UriKind.Absolute), httpContent); if (httpResponse.IsSuccessStatusCode) { var content = await httpResponse.Content.ReadAsStringAsync(); var flightAttendant = JsonConvert.DeserializeObject <FlightAttendant>(content); if (flightAttendant != null) { JwtToken = flightAttendant.Token; return(true); } } return(false); } }