Skip to content

Commit

Permalink
Adding feature to create error info to a new issue on github. Fixed #648
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Feb 9, 2022
1 parent fdbe834 commit bcdba3b
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 38 deletions.
84 changes: 51 additions & 33 deletions FetchXmlBuilder/Forms/ErrorDetail.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 23 additions & 3 deletions FetchXmlBuilder/Forms/ErrorDetail.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
using Microsoft.Xrm.Sdk;
using Rappen.XTB.Helpers.XTBExtensions;
using System;
using System.ServiceModel;
using System.Windows.Forms;
using XrmToolBox.Extensibility;

namespace Cinteros.Xrm.FetchXmlBuilder.Forms
{
public partial class ErrorDetail : Form
{
private DateTime timestamp;
private Exception exception;
private PluginControlBase owner;

public static void ShowDialog(Control owner, Exception error, string heading = null)
public static void ShowDialog(PluginControlBase owner, Exception error, string heading = null)
{
if (error == null)
{
return;
}
new ErrorDetail(error, heading).ShowDialog(owner);
new ErrorDetail(owner, error, heading).ShowDialog(owner);
}

private ErrorDetail(Exception error, string heading)
private ErrorDetail(PluginControlBase owner, Exception error, string heading)
{
this.owner = owner;
exception = error;
timestamp = DateTime.Now;
InitializeComponent();
if (!string.IsNullOrEmpty(heading))
Expand Down Expand Up @@ -76,10 +82,18 @@ private void btnDetails_Click(object sender, EventArgs e)
{
if (Height < 300)
{
btnDetails.Text = "Details <<";
panDetails.Visible = true;
btnCopy.Visible = true;
btnIssue.Visible = true;
Height = 550;
}
else
{
btnDetails.Text = "Details >>";
panDetails.Visible = false;
btnCopy.Visible = false;
btnIssue.Visible = false;
Height = 200;
}
}
Expand All @@ -97,5 +111,11 @@ private void btnCopy_Click(object sender, EventArgs e)
Clipboard.SetText(details);
MessageBox.Show("Copied all details.", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

private void btnIssue_Click(object sender, EventArgs e)
{
GitHub.CreateNewIssueFromError(owner, exception);
TopMost = false;
}
}
}
2 changes: 1 addition & 1 deletion FetchXmlBuilder/Forms/ErrorDetail.resx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAK
7AAACuwB0M+rJQAAAAd0SU1FB9YFFw4AMCHaqGIAAAjRSURBVFhHvVd7cJT1Ff0lIe9sXiASAsaEEEEe
6wAACusBgosNWgAAAAd0SU1FB9YFFw4AMCHaqGIAAAjRSURBVFhHvVd7cJT1Ff0lIe9sXiASAsaEEEEe
Ig9teAqCCFQe8miB2ikdrXVkHEFaZaRjO7aO0oAzRQQKhEcQIUghRCBQESxGnoUQIJB3NrvJ7mZ3k91v
d7/NJpucnt+XCAksHf9ovTMnu5lkvnPu/d177u8T90TQj4TugTQRrg4Sm9QnhF0dF6e6x8aqrp/oVOdT
OtUxJkZtHBWjWiVGRqvmEdFqPWEYFqUahkSqeqJycIRaMShCLc2IVG9nRKgl6eHqjbQwtZi49mioWpQS
Expand Down
2 changes: 1 addition & 1 deletion Rappen.XTB.Helper

0 comments on commit bcdba3b

Please sign in to comment.