-
Notifications
You must be signed in to change notification settings - Fork 0
/
SelectPlanDialog.cs
72 lines (65 loc) · 2.35 KB
/
SelectPlanDialog.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using Microsoft.TeamFoundation.TestManagement.Client;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace TestPlanViewer
{
/// <summary>
/// UI class for a selection box
/// </summary>
public partial class SelectPlanDialog : Form
{
/// <summary>
/// Initializes a new instance of the SelectPlanDialog class
/// </summary>
/// <param name="plans">The list of plan names</param>
public SelectPlanDialog(List<string> plans)
{
this.InitializeComponent();
this.PlansComboBox.Items.AddRange(plans.ToArray());
}
/// <summary>
/// Initializes a new instance of the SelectPlanDialog class
/// </summary>
/// <param name="plans">The list of plan names</param>
public SelectPlanDialog(List<ITestPlan> plans)
{
this.InitializeComponent();
this.PlansComboBox.Items.AddRange(plans.ToArray());
}
/// <summary>
/// Gets the test plan name
/// </summary>
public string Plan { get; private set; }
/// <summary>
/// The accept button was clicked
/// </summary>
/// <param name="sender">The system send object</param>
/// <param name="e">The system event</param>
private void AcceptButton_Click(object sender, EventArgs e)
{
// Make sure the user selected a plan
if (string.IsNullOrEmpty(this.PlansComboBox.Text))
{
MessageBox.Show("No plan was selected", "Plan Selection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
this.Plan = this.PlansComboBox.Text;
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
}
/// <summary>
/// The cancel button was clicked
/// </summary>
/// <param name="sender">The system send object</param>
/// <param name="e">The system event</param>
private void CancelPlanButton_Click(object sender, EventArgs e)
{
this.Plan = string.Empty;
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Close();
}
}
}