private void loginCallback(ServerName output) { this.Dispatcher.BeginInvoke(delegate() { if (output == null || output.servername == null) { MessageBox.Show("Couldn't connect to server"); } else if (output.servername != server.serverName) { MessageBox.Show("Server with this address has different name than the chosen server name"); } else { string url = server.address + "/api/account/login"; LoginInput input = new LoginInput(server.login, server.pass); new HttpPostRequest<LoginInput, LoginOutput>(url, loginCallback, input); } }); }
private void login() { string url = serverUrl + "/api/account/login"; LoginInput input = new LoginInput(loginBox.Text, passwordBox.Password); new HttpPostRequest<LoginInput, LoginOutput>(url, loginCallback, input); }
private void joinMeetingCallback(ServerName result) { this.Dispatcher.BeginInvoke(delegate() { if (result == null) { MessageBox.Show("Couldn't connect to server"); _timer.Start(); } else if (result.servername == null) { MessageBox.Show("Incorrect server response, please contact with administrator or try again later."); _timer.Start(); } else { server.name = result.servername; var servers = new ObservableCollection<Server>(from Server s in MDEDB.Servers where s.serverName == result.servername select s); if (servers.Count() > 0) { server = servers[0]; if (server.sid == null) { MessageBoxResult messageResult = MessageBox.Show("You are not logged in on server. Would you like to log in?", "", MessageBoxButton.OKCancel); if (messageResult == MessageBoxResult.OK) { string url = server.address + "/api/account/login"; LoginInput input = new LoginInput(server.login, server.pass); new HttpPostRequest<LoginInput, LoginOutput>(url, loginCallback, input); } else { _timer.Start(); text = ""; } } else { joinMeeting(); } } else { //TODO go to registration page instead telling a user to do it MessageBox.Show("You are not logged in on server. Please register or log in to server."); NavigationService.Navigate(new Uri("/Pages/AddServerPage.xaml?serverAddress=" + server.address + "&serverName=" + server.name, UriKind.Relative)); } } }); }