public static void LaunchForException(string message, Exception exception) { if (recorded.Contains(message)) { return; } recorded.Add(message); var result = messageBox?.Show( $@"An error occurred: {message} Logged to: {Logging.Directory} {exception.GetType().Name}: {exception.Message} Open an issue on GitHub?", "DiffEngineTray Error", MessageBoxIcon.Error); if (result != true) { return; } var extraBody = WebUtility.UrlEncode($@" * Action: {message} * Exception: ``` {exception} ```"); var url = $"https://github.com/VerifyTests/DiffEngine/issues/new?title={message}&body={defaultBody}{extraBody}"; LinkLauncher.LaunchUrl(url); }
async void save_Click(object sender, EventArgs e) { Settings newSettings = new() { RunAtStartup = startupCheckBox.Checked, AcceptAllHotKey = acceptAllHotKey.HotKey, AcceptOpenHotKey = acceptOpenHotKey.HotKey }; var errors = (await trySave(newSettings)).ToList(); if (!errors.Any()) { DialogResult = DialogResult.OK; return; } StringBuilder builder = new(); foreach (var error in errors) { builder.AppendLine($" * {error}"); } MessageBox.Show(builder.ToString(), "Errors", MessageBoxButtons.OK, MessageBoxIcon.Error); } void diffEngineLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { LinkLauncher.LaunchUrl("https://github.com/VerifyTests/DiffEngine"); } void trayDocsLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { LinkLauncher.LaunchUrl("https://github.com/VerifyTests/DiffEngine/blob/master/docs/tray.md"); } void updateButton_Click(object sender, EventArgs e) { Updater.Run(); } }
public static void Launch() { LinkLauncher.LaunchUrl($"https://github.com/VerifyTests/DiffEngine/issues/new?title=TODO&body={defaultBody}"); }
void trayDocsLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { LinkLauncher.LaunchUrl("https://github.com/VerifyTests/DiffEngine/blob/master/docs/tray.md"); }
void diffEngineLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { LinkLauncher.LaunchUrl("https://github.com/VerifyTests/DiffEngine"); }