private void OnOwnOkButtonClick(object sender, RoutedEventArgs e)
        {
            Organization = OrganizationComboBox?.SelectedItem as SonarQubeOrganization;
            Debug.Assert(Organization != null,
                         "Not expecting organization to be null: user should not have been able to click ok with an invalid selection");

            // Close dialog in the affirmative
            this.DialogResult = true;
        }
        private void OnOtherOrgOkButtonClick(object sender, RoutedEventArgs e)
        {
            var orgKey = IsValidOrganisationKeyConverter.GetTrimmedKey(OrganizationKeyTextBox.Text);

            Debug.Assert(!string.IsNullOrWhiteSpace(orgKey),
                         "Not expecting orgKey to be null: user should not have been able to click ok with an invalid orgKey");

            // We don't know the name of the organization at this point so we'll just use the key.
            // It will be displayed in our UI in the Team Explorer, but that's ok for now.
            Organization = new SonarQubeOrganization(orgKey, orgKey);

            // Close dialog in the affirmative
            this.DialogResult = true;
        }
        internal BoundSonarQubeProject(Uri serverUri, string projectKey, ICredentials credentials = null,
                                       SonarQubeOrganization organization = null)
            : this()
        {
            if (serverUri == null)
            {
                throw new ArgumentNullException(nameof(serverUri));
            }

            if (string.IsNullOrWhiteSpace(projectKey))
            {
                throw new ArgumentNullException(nameof(projectKey));
            }

            this.ServerUri    = serverUri;
            this.Organization = organization;
            this.ProjectKey   = projectKey;
            this.Credentials  = credentials;
        }