// On submit button try to connect user private async void submitButton_Click(object sender, RoutedEventArgs e) { this.startLoading(); this.user = new User() { username = usernameTextBox.Text, password = passwordTextBox.Password }; Message request = new Message() { application = this.application, operation = "authentication", user = user }; Response response = await proxy.DispatcherAsync(request); Console.WriteLine("Operation " + request.operation + " --- " + response.status); if (response.status == "SUCCESS") { stopLoading(); User connectedUser = response.user; Console.WriteLine("User info : "); Console.WriteLine("Username : "******"Password : "******"Token : " + connectedUser.token); Console.WriteLine("LastConnection : " + connectedUser.lastConnection); Console.WriteLine("TokenExpiration : " + connectedUser.tokenExpiration); this.appWindow = new AppWindow(); App.Current.MainWindow = this.appWindow; this.appWindow.setUser(connectedUser); this.appWindow.setAppInfo(this.application); // Close auth window this.Close(); // Open main window this.appWindow.Show(); } else { stopLoading(); MessageBox.Show("Error : Wrong username or password please try again"); } }