private async Task <bool> IsValidAccountInformation() { if (!ValidHost()) { MessageBox.Show("Your Host doesn't appear to be a fully formed URL.", "Incorrect Host!", MessageBoxButton.OK, MessageBoxImage.Error); return(false); } BtnSave.IsEnabled = false; GridCoverAll.Visibility = Visibility.Visible; KallitheaRestClient <User> client = new KallitheaRestClient <User>("get_user", TbxHost.Text, TbxAPIKey.Text); try { KallitheaResponse <User> response = await client.Run(); username = response.Result.Username; return(true); } catch (Exception e) { MessageBox.Show("Error: " + e.Message, "Error!\t\t\t\t", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification); BtnSave.IsEnabled = true; GridCoverAll.Visibility = Visibility.Hidden; return(false); } }
public async Task <ICollection <string> > DownloadRepositories() { KallitheaRestClient <Repository[]> client = new KallitheaRestClient <Repository[]>("get_repos"); try { KallitheaResponse <Repository[]> response = await client.Run(); if (!Directory.Exists(appDataFolder)) { Directory.CreateDirectory(appDataFolder); } File.WriteAllLines(allReposFile, response.Result.Select(r => r.URL).ToArray()); return(response.Result.Select(r => r.URL).ToArray()); } catch (Exception e) { MessageBox.Show("Error: " + e.Message, "Error!\t\t\t\t", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification); return(null); } }