Using Bugz Scout from C

You could use the BugzScout ActiveX object from a .NET language via COM Interop, but there's a better way. In the FogBugz accessories folder on your hard drive, you'll find the ScoutSample.zip file. The BugzScout.Net folder within this zip file contains two C# .NET projects:

• BugzScout is a complete C# implementation of BugzScout.

• ScoutSample is an example of calling the C# version of BugzScout.

Because .NET supports calling across languages, you can use the C# version of BugzScout from any .NET language. Its interface is quite similar to the ActiveX version. Table B-2 shows the members of the BugReport object in the C# version of BugzScout.

Table B-2. BugReport Interface

Member

Type

Description

Area

Property

Project area to contain this bug

DefaultMsg

Property

Default message to return to the user

Description

Property

Description of the bug

Email

Property

E-mail address of the bug submitter

ExtraInformation

Property

Additional information for the notes of the bug

FogBugzURL

Property

URL of your FogBugz server

Table B-2. BugReport Interface (Continued)

Member

Type

Description

FogBugzUserName

Property

User to use when creating the bug

ForceNewBug

Property

Set to true to force a new bug

Project

Property

Project to contain this bug

AppendAssemblyList

Method

Appends a list of assemblies and versions to the bug

Submit

Method

Sends the bug to the server

Here's a calling example from the ScoutSample project:

private void CustomReport(object sender, System.EventArgs e){

try{

BugReport bug = new BugReport(txtUrl.Text, txtUserName.Text);

bug.Project = txtProject.Text;

bug.Area = txtArea.Text;

bug.Description = txtDescription.Text;

bug.Extralnformation = txtExtralnfo.Text;

bug.ForceNewBug = chkForceNewBug.Checked;

bug.Email = txtEmail.Text;

bug.DefaultMsg = txtDefaultMessage.Text;

lblStatus.Text = bug.Submit();

lblStatus.ForeColor = Color.Green;

catch(Exception ex){

lblStatus.ForeColor = Color.Red; lblStatus.Text = ex.Message;

The .NET version of BugzScout uses a slightly different strategy from the ActiveX one for returning information. In case of success, the success message is returned as the return value from the Submit method. In case of any error, the BugReport class raises an exception.

0 0

Post a comment