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 Initialize(YouTrackProxy proxy) { Proxy = proxy; Projects.Clear(); Projects.Add(new ShortProject("", "Everything")); foreach (var project in Proxy.Projects("")) // TODO we can filter projects { Projects.Add(project); } CurrentProjectShortName = ""; }
// TODO: get rid of this. this is only for testing. public static void Process(string comment, YouTrackProxy proxy, string issueId) { var renderedComments = new List<String>(); var guids = new List<Guid>(); var sb = new StringBuilder(); for (int i = 0; i < comment.Length; ++i) { if (comment.Substring(i).StartsWith("[{")) { int end = comment.Substring(i).IndexOf("}]"); if (end != -1) { string toRasterize = comment.Substring(i + 2, end - 2); renderedComments.Add(toRasterize); Guid g = Guid.NewGuid(); sb.Append('!').Append(g.ToString()).Append(".png!"); guids.Add(g); i = end + 2; continue; } } sb.Append(comment[i]); } // well okay now render all that stuff var tempPath = Path.GetTempPath(); var filesToDelete = new List<string>(); for (int i = 0; i < renderedComments.Count; ++i) { using (var bmp = RenderFreeformText(776, 1024, renderedComments[i])) { string whereToPut = Path.Combine(tempPath, guids[i].ToString() + ".png"); bmp.Save(whereToPut, ImageFormat.Png); filesToDelete.Add(whereToPut); // now send it proxy.AttachFile(issueId, whereToPut); } } proxy.SubmitComment(issueId, sb.ToString()); }