SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
EditRunControl.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Linq;
7 using System.Text;
8 using System.Windows.Forms;
9 
10 namespace SeciUserInterface.Forms
11 {
12  public partial class EditRunControl : Form
13  {
15 
16  public Seci.Definitions.BlockInfo Block { get { return _block; } }
17 
18  public EditRunControl(Seci.Definitions.BlockInfo block)
19  {
20  InitializeComponent();
21  _block = block;
22  }
23 
24  private void EditRunControl_Load(object sender, EventArgs e)
25  {
26  Seci.Definitions.ControlType type = Seci.Managers.LabViewMgr.GetControlType(_block.ParentVI, _block.ReadControl);
27 
28  if (type == Seci.Definitions.ControlType.STRING || type == Seci.Definitions.ControlType.BOOLEAN)
29  {
30  lblLower.Text = "Value: ";
31  lblUpper.Visible = false;
32  txtUpper.Visible = false;
33  txtName.Text = "Block Name: " + _block.BlockName;
34  txtLower.Text = _block.RunControlValue;
35  txtUpper.Text = "";
36  chkUnderRC.Checked = _block.UnderRunControl;
37  }
38  else
39  {
40  txtName.Text = "Block Name: " + _block.BlockName;
41  txtLower.Text = _block.LowerLimit.ToString();
42  txtUpper.Text = _block.UpperLimit.ToString();
43  chkUnderRC.Checked = _block.UnderRunControl;
44  }
45  }
46 
47  private void btnOK_Click(object sender, EventArgs e)
48  {
49  double lower;
50  double upper;
51 
52  Seci.Definitions.ControlType type = Seci.Managers.LabViewMgr.GetControlType(_block.ParentVI, _block.ReadControl);
53 
54  if (type == Seci.Definitions.ControlType.STRING || type == Seci.Definitions.ControlType.BOOLEAN)
55  {
56  if (!String.IsNullOrEmpty(txtLower.Text))
57  {
58  _block.SetRunControlLimits(chkUnderRC.Checked, txtLower.Text);
59  }
60  else if (chkUnderRC.Checked)
61  {
62  MessageBox.Show("Please enter a value for run-control", "Invalid Value", MessageBoxButtons.OK, MessageBoxIcon.Error);
63  return;
64  }
65  }
66  else
67  {
68 
69  try
70  {
71  lower = Convert.ToDouble(txtLower.Text);
72  }
73  catch
74  {
75  MessageBox.Show("Invalid value entered for lower limit", "Invalid Value", MessageBoxButtons.OK, MessageBoxIcon.Error);
76  return;
77  }
78 
79  try
80  {
81  upper = Convert.ToDouble(txtUpper.Text);
82  }
83  catch
84  {
85  MessageBox.Show("Invalid value entered for upper limit", "Invalid Value", MessageBoxButtons.OK, MessageBoxIcon.Error);
86  return;
87  }
88 
89  _block.SetRunControlLimits(chkUnderRC.Checked, lower, upper);
90  }
91 
92  DialogResult = DialogResult.OK;
93  Close();
94  }
95  }
96 }
This class is used for storing the information for any blocks that are created and provides methods f...
Definition: BlockInfo.cs:18
void btnOK_Click(object sender, EventArgs e)
Seci.Definitions.BlockInfo _block
void EditRunControl_Load(object sender, EventArgs e)
EditRunControl(Seci.Definitions.BlockInfo block)