public bool TryValidateConnection(ReTrackSettings reTrackSettings, out string errorMessage) { try { using (var proxy = new YouTrackProxy(reTrackSettings)) { errorMessage = ""; return(true); } } catch (Exception ex) { if (ex.Message.ToLowerInvariant() == "not found" || ex is WebException) { errorMessage = "An error occurred while connecting to the remote server. Verify the URL is correct and try again."; return(false); } else if (ex is AuthenticationException) { errorMessage = "An error occurred while authenticating with the remote server. Verify your credentials and try again."; return(false); } else { errorMessage = "An unspecified error occurred while connecting to the remote server."; return(false); } } }
public bool TryValidateConnection(ReTrackSettings reTrackSettings, out string errorMessage) { try { using (var proxy = new YouTrackProxy(reTrackSettings)) { errorMessage = ""; return true; } } catch (Exception ex) { if (ex.Message.ToLowerInvariant() == "not found" || ex is WebException) { errorMessage = "An error occurred while connecting to the remote server. Verify the URL is correct and try again."; return false; } else if (ex is AuthenticationException) { errorMessage = "An error occurred while authenticating with the remote server. Verify your credentials and try again."; return false; } else { errorMessage = "An unspecified error occurred while connecting to the remote server."; return false; } } }
public void InitializeViewFromSettings(ReTrackSettings settings) { if (!string.IsNullOrEmpty(settings.Url)) { var proxy = new YouTrackProxy(settings); IssueBrowserViewModel.Initialize(proxy); } }
public void StoreSettingsInAppConfig(ReTrackSettings settings) { var configuration = ConfigurationManager.OpenExeConfiguration(_configurationFilePath); SetAppSettingsValue(configuration, "ReTrackSettings.Username", settings.Username); SetAppSettingsValue(configuration, "ReTrackSettings.Password", settings.Password); SetAppSettingsValue(configuration, "ReTrackSettings.Url", settings.Url); configuration.Save(ConfigurationSaveMode.Modified); }
public YouTrackProxy(ReTrackSettings s) : this(s.Username, s.Password, new Uri(s.Url)) { BaseUrl = s.Url; }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); Settings = _standaloneSettingsManager.PopulateSettingsFromAppConfig(); }
public YouTrackProxy(ReTrackSettings s) : this(s.Username, s.Password, new Uri(s.Url)) { BaseUrl = s.Url; }