using System; using System.Drawing; using System.Windows.Forms; namespace TBF.UiControls { public partial class TestProgressCtrl : UserControl { public enum Result { NotDone, Passed, Failed, } public Result TestResult { set { //switch (value) //{ // case Result.NotDone: resultPictureBox.Image = Properties.Resources.TestNotDoneImage; break; // case Result.Passed: resultPictureBox.Image = Properties.Resources.TestPassedImage; break; // case Result.Failed: resultPictureBox.Image = Properties.Resources.TestFailedImage; break; //} } } public bool Selected; int testId; public int TestId { get { return testId; } } string testName; public string TestName { get { return testName; } } int repetitionNr; public int RepetitionNr { get { return repetitionNr; } } public string Title { set { testNameLabel.Text = value; } } public float Progress { set { testProgressBar.Value = (int)(100.499f * value); } } public ProgressBar TestProgressBar { get { return testProgressBar; } } public TestProgressCtrl() { InitializeComponent(); this.Progress = 0; this.TestResult = UiControls.TestProgressCtrl.Result.NotDone; } public TestProgressCtrl(int testId, string testName, int repetitionNr, int testRepeats) : this() { this.testId = testId; this.testName = testName; this.repetitionNr = repetitionNr; this.Title = testName + string.Format(" ({0}/{1})", repetitionNr, testRepeats); } public TestProgressCtrl(int testId, string testName) : this(testId, testName, 1, 1) { this.Title = testName; } private void TestProgressCtrl_Click(object sender, System.EventArgs e) { if (Selected) { Selected = false; BackColor = Color.Transparent; } else { Selected = true; BackColor = Color.Orange; } } } }