Beispiel #1
0
        public static void ShowSubmissionResult(IWin32Window owner, SubmissionResult submissionResult, string projectKey)
        {
            string msgBoxText = "Thank you for your bug report!";

            if (IsRequestFixed(submissionResult))
            {
                string resolution = GetRequestResolution(submissionResult);
                if (resolution == null)
                {
                    msgBoxText += "\nThis request (" + BuildRequestNumber(submissionResult.ThreadId, projectKey) + ") has already been FIXED";
                }
                else
                {
                    msgBoxText += "\nThis request (" + BuildRequestNumber(submissionResult.ThreadId, projectKey) + ") has been resolved as " + resolution;
                }
                msgBoxText += GetFixVersionText(submissionResult);
            }
            else
            {
                string verb = submissionResult.IsUpdated ? "updated" : "created";
                msgBoxText += "\n";
                msgBoxText += "Request " + BuildRequestNumber(submissionResult.ThreadId, projectKey) + " has been " + verb;
            }
            MessageBox.Show(owner, msgBoxText, "Report Unhandled Exception", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Beispiel #2
0
        private static string GetRequestResolution(SubmissionResult submissionResult)
        {
            XmlDocument requestDescripion = submissionResult.RequestDescription;

            if (requestDescripion == null)
            {
                return(null);
            }
            return(requestDescripion.DocumentElement.GetAttribute("resolution"));
        }
Beispiel #3
0
        private static bool IsRequestFixed(SubmissionResult submissionResult)
        {
            XmlDocument requestDescripion = submissionResult.RequestDescription;

            if (requestDescripion == null)
            {
                return(false);
            }
            string state = requestDescripion.DocumentElement.GetAttribute("state");

            return(state == "Fixed" || state == "Resolved");
        }
Beispiel #4
0
        private void _btnSubmit_Click(object sender, EventArgs e)
        {
            string userName = _edtUserName.Text;
            string password = _edtPassword.Text;

            if (userName == "" || password == "")
            {
                if (_defaultUserName == "" || _defaultPassword == "")
                {
                    MessageBox.Show(this, "Please enter your user name and password.", "Report Unhandled Exception", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                userName = _defaultUserName;
                password = _defaultPassword;
            }

            try
            {
                _btnSubmit.Enabled = false;

                string description;
                if (_edtDescription.Text.Length > 0)
                {
                    description = _edtDescription.Text + "\n" + _buildDesc;
                }
                else
                {
                    description = _buildDesc;
                }

                _submitter.SubmitProgress += new SubmitProgressEventHandler(submitter_SubmitProgress);
                SubmissionResult submissionResult = _submitter.SubmitException(_exception, description, userName, password, _buildNumber, ProxySettings.Proxy);

                if (_displaySubmissionResult && submissionResult != null)
                {
                    ShowSubmissionResult(this, submissionResult, this._projectKey);
                }
                else
                {
                    MessageBox.Show(this, "Thank you for your bug report!", "Report Unhandled Exception", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Error submitting exception to the tracker.\n" + ex.ToString(), "Report Unhandled Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            _submitter = null;
        }
Beispiel #5
0
        private static string GetFixVersionText(SubmissionResult submissionResult)
        {
            XmlDocument requestDescripion = submissionResult.RequestDescription;

            if (requestDescripion == null)
            {
                return("");
            }

            XmlNodeList versionNodes = requestDescripion.SelectNodes("//fixVersions/version");

            if (versionNodes.Count == 0)
            {
                return("");
            }

            if (versionNodes.Count == 1)
            {
                return(" in version " + versionNodes [0].Attributes ["name"].Value);
            }

            StringBuilder result = new StringBuilder(" in versions ");
            bool          first  = true;

            foreach (XmlNode node in versionNodes)
            {
                if (!first)
                {
                    result.Append(", ");
                }
                else
                {
                    first = false;
                }
                result.Append(node.Attributes ["name"].Value);
            }
            return(result.ToString());
        }