예제 #1
0
        public JiraApiClient GetClientWithNewSettings(JiraSettings jiraSettings)
        {
            _jiraSettingsStorage.Set(jiraSettings);

             JiraApiClient result = new JiraApiClient(jiraSettings);
             return result;
        }
예제 #2
0
      private void HandleOkClick(object sender, RoutedEventArgs e)
      {
         List<string> validationErrors = new List<string>();
         if (!Uri.IsWellFormedUriString(_baseUrlTextBox.Text, UriKind.Absolute))
         {
            validationErrors.Add("Base URL is invalid.");
         }
         if (string.IsNullOrEmpty(_userNameTextBox.Text))
         {
            validationErrors.Add("User name cannot be empty.");
         }
         if (string.IsNullOrEmpty(_passwordBox.Password))
         {
            validationErrors.Add("Password cannot be empty.");
         }

         if (validationErrors.Any())
         {
            MessageBox.Show(this, string.Join(Environment.NewLine, validationErrors), "Invalid values", MessageBoxButton.OK, MessageBoxImage.Error);
         }
         else
         {
            ProvidedSettings = new JiraSettings(new Uri(_baseUrlTextBox.Text), _userNameTextBox.Text, _passwordBox.Password);
            DialogResult = true;
         }
      }
예제 #3
0
 public JiraApiClient(JiraSettings jiraSettings)
 {
    _baseUrl = jiraSettings.BaseUrl;
    _restClient = new RestClient(new Uri(jiraSettings.BaseUrl, "rest/api/2"))
    {
       Authenticator = new HttpBasicAuthenticator(jiraSettings.UserName, jiraSettings.Password)
    };
    _restClient.AddHandler("application/json", new DynamicJsonDeserializer());
 }