private void BtnLoginAppBar_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(Username) || string.IsNullOrWhiteSpace(passwordBox.Password)) { MessageBox.Show("Username or password cannot be empty!"); } else if (Username.IndexOf('@') != -1) { MessageBox.Show("Username only, not e-mail."); } else { Credentials credentials = new Credentials(Username, passwordBox.Password); Octokit.Internal.InMemoryCredentialStore inMemoryCredentialStore = new Octokit.Internal.InMemoryCredentialStore(credentials); App.GitHubClient = new Octokit.GitHubClient(new Octokit.ProductHeaderValue("GitHubWin8"), inMemoryCredentialStore); MessageBox.Show("DEV: There is no crediential falidation for now !"); // TODO bool isCredentialsVaild = true; if (isCredentialsVaild) { this.NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); } else { MessageBox.Show("Invalid password of username !"); } } }
static async Task Main(string[] args) { var config = new ConfigurationBuilder() .AddEnvironmentVariables() .AddCommandLine(args) .AddUserSecrets <Program>() .Build(); var secrets = config.GetSection("SECRETS"); var userName = secrets?["GITHUB_USERNAME"]; var password = secrets?["GITHUB_PASSWORD"]; var loadedIssues = LoadIssues(@"c:\Users\MarkJunker\Downloads\quickgraph\issues\").ToList(); var credentialStore = new Octokit.Internal.InMemoryCredentialStore(new Credentials(userName, password)); var client = new Octokit.GitHubClient(new Octokit.ProductHeaderValue("codeplex-issue-import", "0.0.1"), credentialStore); _throttler = new GitHubRequestThrottler(client); var repository = await client.Repository.Get("FubarDevelopment", "QuickGraph"); var labels = loadedIssues.Select(x => x.issue.WorkItem.AffectedComponent) .Where(x => !string.IsNullOrEmpty(x?.Name)) .Distinct(new CodePlexComponentComparer()); await ImportComponentLabelsAsync(client, repository, labels); var priorities = loadedIssues.Select(x => x.issue.WorkItem.Priority) .Where(x => !string.IsNullOrEmpty(x?.Name)) .Distinct(new CodePlexPriorityComparer()); await ImportPriorityLabelsAsync(client, repository, priorities); var closeReasons = loadedIssues.Select(x => x.issue.WorkItem.ReasonClosed) .Where(x => !string.IsNullOrEmpty(x?.Name)) .Select(x => x.Name) .Distinct(); await ImportIssuesAsync(client, repository, loadedIssues); }