private void ProjectNameBox_TextChanged(object sender, EventArgs e) { var projectName = _projectNameBox.Text; var project = new GoogleCodeProject().IsValidProjectName(projectName) ? new GoogleCodeProject(projectName) : null; _okButton.Enabled = _testButton.Enabled = project != null; _linkLabel.Text = (project != null ? project.Url : GoogleCodeProject.HostingUrl).ToString(); }
private void TestButton_Click(object sender, EventArgs e) { try { var projectName = _projectNameBox.Text; var url = new GoogleCodeProject(projectName).DnsUrl(); using (CurrentCursorScope.EnterWait()) new WebClient().DownloadData(url); var message = string.Format("The Google Code project '{0}' appears valid and reachable at {1}.", projectName, url); MessageBox.Show(message, "Test Passed", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (WebException we) { MessageBox.Show(we.Message, "Test Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } }