using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using QC.QsprShared.Dialogs;
using QC.QsprTestObjects.Parameters;
using QC.QsprTestObjects.TestConditions;
using QC.QsprTestObjects.Tests.Base;

namespace QC.QsprTestObjects.Loops;

public class ScenarioConditionDialog : Form
{
	private const int FOLDER_IMAGE = 1;

	private const int FOLDER_SELECTED_IMAGE = 0;

	private const int SCENARIO_IMAGE = 1;

	private const int TEST_IMAGE = 2;

	private const int SCENARIO_SELECTED_IMAGE = 0;

	private FolderTest loopFolder;

	private Hashtable nodeCollection = new Hashtable();

	private ConditionMgr scenarioConditionMgr = new ConditionMgr();

	private ScenarioCondition conditionSelected;

	private ScenarioCondition conditionToModify;

	public bool ignoreSelectionChange;

	public bool resetParamNameOnTreeChange = true;

	private bool conditionSelectedIsNew;

	private IContainer components;

	private Label label1;

	private Button btnOK;

	private Button btnCancel;

	private TreeView ultraTreeView;

	private ImageList imageList;

	private CheckBox chkConditionActive;

	private GroupBox groupBox2;

	private FormulaBuilderUC formulaBuilderUC1;

	private CreateConditionUC createCondition;

	private Button btnNewCondition;

	private Button btnDeleteCondition;

	private Button btnSaveCondition;

	private GroupBox groupBox1;

	private RadioButton radioMet;

	private RadioButton radioNotMet;

	private Button btnDeleteAllConditions;

	public FolderTest LoopFolder
	{
		set
		{
			try
			{
				loopFolder = value;
				Text = Text + " - " + value.Properties.TestName;
			}
			catch
			{
			}
		}
	}

	public ConditionMgr ScenarioConditionMgr
	{
		get
		{
			return scenarioConditionMgr;
		}
		set
		{
			scenarioConditionMgr = value;
		}
	}

	public ScenarioConditionDialog()
	{
		InitializeComponent();
		createCondition.ParameterType = ConditionParameterType.Both;
		formulaBuilderUC1.AddGridSelectionChangeHandler(conditionGrid_SelectionChange);
	}

	private void ScenarioCondition_Load(object sender, EventArgs e)
	{
		try
		{
			if (scenarioConditionMgr == null)
			{
				scenarioConditionMgr = new ConditionMgr();
			}
			ignoreSelectionChange = true;
			foreach (BaseCondition condition in scenarioConditionMgr.Conditions)
			{
				formulaBuilderUC1.AddCondition(condition);
			}
			conditionSelected = formulaBuilderUC1.SelectedCondition as ScenarioCondition;
			if (conditionSelected != null)
			{
				conditionToModify = conditionSelected.Clone() as ScenarioCondition;
			}
			chkConditionActive.Checked = scenarioConditionMgr.Enabled;
			radioNotMet.Checked = scenarioConditionMgr.NegateResult;
			formulaBuilderUC1.Expression = scenarioConditionMgr.Expression;
			ignoreSelectionChange = false;
			LoadTreeView();
			LoadCondition();
		}
		catch
		{
		}
	}

	private void LoadTreeView()
	{
		try
		{
			TreeNode treeNode = ultraTreeView.Nodes.Add("", loopFolder.Properties.TestName);
			treeNode.Tag = loopFolder;
			nodeCollection.Add(loopFolder.Index, treeNode);
			LoadTree(loopFolder, treeNode);
			ResetTestTree(treeNode);
			ultraTreeView.ExpandAll();
		}
		catch
		{
		}
	}

	private void LoadCondition()
	{
		try
		{
			if (conditionToModify != null)
			{
				ultraTreeView.Enabled = true;
				createCondition.Enabled = true;
				btnDeleteCondition.Enabled = true;
				btnSaveCondition.Enabled = true;
				if (conditionToModify.TestIndex == "")
				{
					createCondition.Parameters = null;
				}
				if (conditionToModify.TestConditionType != ConditionType.GlobalVariables && conditionToModify.TestIndex != "" && nodeCollection.ContainsKey(conditionToModify.TestIndex))
				{
					TreeNode treeNode = (TreeNode)nodeCollection[conditionToModify.TestIndex];
					resetParamNameOnTreeChange = false;
					ultraTreeView.SelectedNode = treeNode;
					resetParamNameOnTreeChange = true;
					treeNode.EnsureVisible();
				}
				else
				{
					ultraTreeView.SelectedNode = null;
				}
				createCondition.Condition = conditionToModify;
			}
		}
		catch
		{
		}
	}

	private void LoadTree(FolderTest folder, TreeNode parentNode)
	{
		try
		{
			foreach (BaseTest test in folder.TestList)
			{
				TreeNode treeNode = parentNode.Nodes.Add("", test.Properties.TestName);
				treeNode.Tag = test;
				nodeCollection.Add(test.Index, treeNode);
				if (test is FolderTest)
				{
					LoadTree((FolderTest)test, treeNode);
				}
			}
		}
		catch
		{
		}
	}

	private void ResetTestTree(TreeNode ParentNode)
	{
		if (ParentNode.Nodes.Count > 0)
		{
			BaseTest baseTest = (BaseTest)ParentNode.Tag;
			if (((FolderTest)baseTest).FolderProperties.Scenarios != null)
			{
				if (((FolderTest)baseTest).FolderProperties.Scenarios.Count > 0)
				{
					ParentNode.ImageIndex = 1;
					ParentNode.SelectedImageIndex = 0;
				}
				else
				{
					ParentNode.ImageIndex = 1;
					ParentNode.SelectedImageIndex = 0;
				}
			}
			else
			{
				ParentNode.ImageIndex = 1;
				ParentNode.SelectedImageIndex = 0;
			}
		}
		foreach (TreeNode node in ParentNode.Nodes)
		{
			if (node.Nodes.Count > 0)
			{
				BaseTest baseTest2 = (BaseTest)node.Tag;
				if (((FolderTest)baseTest2).FolderProperties.Scenarios != null)
				{
					if (((FolderTest)baseTest2).FolderProperties.Scenarios.Count > 0)
					{
						node.ImageIndex = 1;
						node.SelectedImageIndex = 0;
					}
					else
					{
						node.ImageIndex = 1;
						node.SelectedImageIndex = 0;
					}
				}
				else
				{
					node.ImageIndex = 1;
					node.SelectedImageIndex = 0;
				}
				if (baseTest2.Properties.LinkNode && baseTest2.Properties.IsLinkActive != true)
				{
					node.ForeColor = Color.Red;
				}
				ResetTestTree(node);
			}
			else
			{
				BaseTest baseTest3 = (BaseTest)node.Tag;
				if (baseTest3 is FolderTest)
				{
					node.ImageIndex = 1;
					node.SelectedImageIndex = 0;
				}
				else
				{
					node.ImageIndex = 2;
					node.SelectedImageIndex = 2;
				}
				if (baseTest3.Properties.LinkNode && baseTest3.Properties.IsLinkActive != true)
				{
					node.ForeColor = Color.Red;
				}
			}
		}
	}

	private void ultraTreeView_AfterSelect(object sender, TreeViewEventArgs e)
	{
		try
		{
			BaseTest baseTest = (BaseTest)ultraTreeView.SelectedNode.Tag;
			createCondition.Parameters = baseTest.Properties.Parameters;
			conditionToModify.TestIndex = baseTest.Index;
			if (resetParamNameOnTreeChange)
			{
				conditionToModify.ParameterName = "";
			}
		}
		catch
		{
		}
	}

	private void chkConditionActive_CheckedChanged(object sender, EventArgs e)
	{
		if (chkConditionActive.Checked)
		{
			radioMet.Enabled = true;
			radioNotMet.Enabled = true;
			label1.ForeColor = SystemColors.ControlText;
		}
		else
		{
			radioMet.Enabled = false;
			radioNotMet.Enabled = false;
			label1.ForeColor = SystemColors.ControlDarkDark;
		}
	}

	private void conditionGrid_SelectionChange(object sender, EventArgs e)
	{
		if (ignoreSelectionChange)
		{
			return;
		}
		ignoreSelectionChange = true;
		if (!ValidateSelectedConditions())
		{
			formulaBuilderUC1.HighlightedCondition = conditionSelected;
			ignoreSelectionChange = false;
			return;
		}
		if (formulaBuilderUC1.SelectedCondition != null)
		{
			conditionSelected = formulaBuilderUC1.SelectedCondition as ScenarioCondition;
			conditionToModify = conditionSelected.Clone() as ScenarioCondition;
			LoadCondition();
		}
		conditionSelectedIsNew = false;
		ignoreSelectionChange = false;
	}

	private void btnOK_Click(object sender, EventArgs e)
	{
		try
		{
			if (!ValidateSelectedConditions())
			{
				return;
			}
			if (!chkConditionActive.Checked)
			{
				switch (AppMessageDialog.Show(this, "Break condition is not enabled. Do you want to enable it?", "QSPR - Message Center", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation, DialogResult.No, MessageDialogType.Warning))
				{
				case DialogResult.Yes:
					chkConditionActive.Checked = true;
					break;
				case DialogResult.Cancel:
					return;
				}
			}
			if (formulaBuilderUC1.Expression.Trim().Length == 0 && formulaBuilderUC1.NumberOfConditions == 1 && chkConditionActive.Checked)
			{
				if (AppMessageDialog.Show("Default expression will be used: " + formulaBuilderUC1.GetCondition(0).Name, "QSPR - Message Center", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, DialogResult.OK, MessageDialogType.Warning) == DialogResult.Cancel)
				{
					return;
				}
				formulaBuilderUC1.Expression = formulaBuilderUC1.GetCondition(0).Name;
			}
			if ((formulaBuilderUC1.Expression.Trim().Length == 0 && !chkConditionActive.Checked) || formulaBuilderUC1.CheckSyntax(showSuccessDialog: false))
			{
				scenarioConditionMgr = new ConditionMgr(formulaBuilderUC1.Expression);
				scenarioConditionMgr.Enabled = chkConditionActive.Checked;
				scenarioConditionMgr.NegateResult = radioNotMet.Checked;
				for (int i = 0; i < formulaBuilderUC1.NumberOfConditions; i++)
				{
					scenarioConditionMgr.AddCondition(formulaBuilderUC1.GetCondition(i));
				}
				base.DialogResult = DialogResult.OK;
				Close();
			}
		}
		catch
		{
		}
	}

	private void btnNewCondition_Click(object sender, EventArgs e)
	{
		ignoreSelectionChange = true;
		if (!ValidateSelectedConditions())
		{
			ignoreSelectionChange = false;
			return;
		}
		ScenarioCondition scenarioCondition = new ScenarioCondition();
		scenarioCondition.root = loopFolder.Root;
		if (conditionSelected != null)
		{
			conditionSelected.Copy(scenarioCondition);
		}
		int i;
		for (i = 1; formulaBuilderUC1.GetCondition("C" + i) != null; i++)
		{
		}
		scenarioCondition.Name = "C" + i;
		conditionSelected = scenarioCondition;
		conditionToModify = scenarioCondition.Clone() as ScenarioCondition;
		formulaBuilderUC1.AddCondition(scenarioCondition);
		formulaBuilderUC1.HighlightedCondition = scenarioCondition;
		LoadCondition();
		conditionSelectedIsNew = true;
		ignoreSelectionChange = false;
	}

	private void btnDeleteCondition_Click(object sender, EventArgs e)
	{
		ignoreSelectionChange = true;
		if (AppMessageDialog.Show("Are you sure you want to delete " + conditionSelected.Name + "?", "Delete Condition", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, DialogResult.Yes, MessageDialogType.Warning) == DialogResult.Yes)
		{
			formulaBuilderUC1.RemoveCondition(conditionSelected);
			formulaBuilderUC1.HighlightedCondition = new BaseCondition();
			conditionSelected = null;
			conditionToModify = null;
			btnDeleteCondition.Enabled = false;
			btnSaveCondition.Enabled = false;
			createCondition.Enabled = false;
			ultraTreeView.Enabled = false;
		}
		ignoreSelectionChange = false;
	}

	private void btnDeleteAllConditions_Click(object sender, EventArgs e)
	{
		ignoreSelectionChange = true;
		if (AppMessageDialog.Show("Are you sure you want to delete all conditions?", "Delete Condition", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, DialogResult.Yes, MessageDialogType.Warning) == DialogResult.Yes)
		{
			formulaBuilderUC1.RemoveAllConditions();
			formulaBuilderUC1.HighlightedCondition = new BaseCondition();
			conditionSelected = null;
			conditionToModify = null;
			btnDeleteCondition.Enabled = false;
			btnSaveCondition.Enabled = false;
			createCondition.Enabled = false;
			ultraTreeView.Enabled = false;
		}
		ignoreSelectionChange = false;
	}

	private void btnSaveCondition_Click(object sender, EventArgs e)
	{
		SaveCondition();
	}

	private bool HasConditionChanged()
	{
		if (conditionSelected == null)
		{
			return false;
		}
		return !conditionSelected.Equals(conditionToModify);
	}

	private bool ValidateSelectedConditions()
	{
		if (conditionToModify != null && !conditionToModify.IsValid)
		{
			AppMessageDialog.Show("Condition " + conditionSelected.Name + " is not valid. Please edit.", "QSPR - Message Center", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, DialogResult.OK, MessageDialogType.Error);
			return false;
		}
		if (HasConditionChanged())
		{
			switch (AppMessageDialog.Show(conditionSelected.Name + " has changed. Do you want to save?", "QSPR - Message Center", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation, DialogResult.Yes, MessageDialogType.Warning))
			{
			case DialogResult.Yes:
				conditionSelectedIsNew = true;
				if (!SaveCondition())
				{
					return false;
				}
				break;
			case DialogResult.Cancel:
				return false;
			default:
				if (conditionSelected != null && !conditionSelected.IsValid)
				{
					AppMessageDialog.Show("Condition " + conditionSelected.Name + " is not valid. Please edit.", "QSPR - Message Center", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, DialogResult.OK, MessageDialogType.Error);
					return false;
				}
				break;
			}
		}
		return true;
	}

	private bool SaveCondition()
	{
		string text = "";
		Regex regex = new Regex("[^a-zA-Z0-9_]");
		if (!conditionSelectedIsNew && AppMessageDialog.Show("Do you want to overwrite condition " + conditionSelected.Name + "?", "QSPR - Message Center", MessageBoxButtons.YesNo, MessageBoxIcon.Question, DialogResult.Yes, MessageDialogType.Warning) == DialogResult.No)
		{
			return false;
		}
		if (conditionToModify.Name.Length == 0)
		{
			text = "Please enter a condition name.";
		}
		else if (regex.IsMatch(conditionToModify.Name))
		{
			text = "Condition names can only contain alphanumeric characters and underscores.\nSpaces, tabs, and special characters are not allowed.";
		}
		else
		{
			for (int i = 0; i < formulaBuilderUC1.NumberOfConditions; i++)
			{
				BaseCondition condition = formulaBuilderUC1.GetCondition(i);
				if (!condition.Equals(conditionSelected) && condition.Name.Equals(conditionToModify.Name, StringComparison.OrdinalIgnoreCase))
				{
					text = "A condition with name " + conditionToModify.Name + " already exists.";
				}
			}
		}
		if (text != "")
		{
			AppMessageDialog.Show(this, text, "QSPR - Message Center", MessageBoxButtons.OK, MessageBoxIcon.Hand, DialogResult.OK, MessageDialogType.Error);
			return false;
		}
		switch (conditionToModify.TestConditionType)
		{
		case ConditionType.TestParameters:
		{
			if (ultraTreeView.SelectedNode == null)
			{
				AppMessageDialog.Show(this, "Please select a test node.", "QSPR - Message Center", MessageBoxButtons.OK, MessageBoxIcon.Hand, DialogResult.OK, MessageDialogType.Warning);
				return false;
			}
			string index = ((BaseTest)ultraTreeView.SelectedNode.Tag).Index;
			text = "";
			if (conditionToModify.ParameterName.Trim().Length == 0)
			{
				text += "Parameter selection is required. ";
			}
			ParameterCls selectedParameter = createCondition.GetSelectedParameter();
			if (selectedParameter != null)
			{
				if (conditionToModify.CompareToType == CompareType.Constant && !selectedParameter.IsValueValid(conditionToModify.ParameterValue))
				{
					text += "Parameter value is not valid. ";
				}
				else if (conditionToModify.CompareToType == CompareType.Constant && conditionToModify.ParameterValue.Length == 0)
				{
					DialogResult dialogResult2 = AppMessageDialog.Show(this, "Parameter Value is Empty String. Do you want to continue?", "QSPR - Message Center", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, DialogResult.Yes, MessageDialogType.Warning);
					if (dialogResult2 == DialogResult.No)
					{
						return false;
					}
				}
				else if (conditionToModify.CompareToType == CompareType.GlobalVariable && conditionToModify.GVToCompareName == "")
				{
					text += "A global variable to compare to is not selected. ";
				}
			}
			if (text != "")
			{
				AppMessageDialog.Show(this, text, "QSPR - Message Center", MessageBoxButtons.OK, MessageBoxIcon.Hand, DialogResult.OK, MessageDialogType.Error);
				return false;
			}
			conditionSelected.Name = conditionToModify.Name;
			conditionSelected.TestConditionType = conditionToModify.TestConditionType;
			conditionSelected.ParameterName = conditionToModify.ParameterName;
			conditionSelected.ParameterIndex = conditionToModify.ParameterIndex;
			conditionSelected.ParameterSign = conditionToModify.ParameterSign;
			conditionSelected.ParameterValue = conditionToModify.ParameterValue;
			conditionSelected.TestIndex = index;
			conditionSelected.GVToCompareName = conditionToModify.GVToCompareName;
			conditionSelected.CompareToType = conditionToModify.CompareToType;
			formulaBuilderUC1.UpdateConditionStrings();
			break;
		}
		case ConditionType.TestResult:
		{
			if (ultraTreeView.SelectedNode == null)
			{
				AppMessageDialog.Show(this, "Please select a test node.", "QSPR - Message Center", MessageBoxButtons.OK, MessageBoxIcon.Hand, DialogResult.OK, MessageDialogType.Warning);
				return false;
			}
			string index = ((BaseTest)ultraTreeView.SelectedNode.Tag).Index;
			conditionSelected.Name = conditionToModify.Name;
			conditionSelected.TestConditionType = conditionToModify.TestConditionType;
			conditionSelected.Result = conditionToModify.Result;
			conditionSelected.TestIndex = index;
			formulaBuilderUC1.UpdateConditionStrings();
			break;
		}
		case ConditionType.GlobalVariables:
			text = "";
			if (conditionToModify.GlobalVariableName.Trim().Length == 0)
			{
				text += "Global variable selection is required. ";
			}
			if (conditionToModify.CompareToType == CompareType.Constant && conditionToModify.GlobalVariableValue.Length == 0)
			{
				DialogResult dialogResult = AppMessageDialog.Show(this, "Global variable value is Empty String. Do you want to continue?", "QSPR - Message Center", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, DialogResult.Yes, MessageDialogType.Warning);
				if (dialogResult == DialogResult.No)
				{
					return false;
				}
			}
			else if (conditionToModify.CompareToType == CompareType.GlobalVariable && conditionToModify.GVToCompareName == "")
			{
				text += "A global variable to which to compare is not selected. ";
			}
			else if (conditionToModify.CompareToType == CompareType.LowerLimit || conditionToModify.CompareToType == CompareType.UpperLimit)
			{
				text += "Condition type error. ";
			}
			if (text != "")
			{
				AppMessageDialog.Show(this, text, "QSPR - Message Center", MessageBoxButtons.OK, MessageBoxIcon.Hand, DialogResult.OK, MessageDialogType.Error);
				return false;
			}
			conditionSelected.Name = conditionToModify.Name;
			conditionSelected.TestConditionType = conditionToModify.TestConditionType;
			conditionSelected.GlobalVariableName = conditionToModify.GlobalVariableName;
			conditionSelected.GlobalVariableSign = conditionToModify.GlobalVariableSign;
			conditionSelected.GlobalVariableValue = conditionToModify.GlobalVariableValue;
			conditionSelected.GVToCompareName = conditionToModify.GVToCompareName;
			conditionSelected.CompareToType = conditionToModify.CompareToType;
			formulaBuilderUC1.UpdateConditionStrings();
			break;
		}
		conditionSelectedIsNew = false;
		return true;
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		this.components = new System.ComponentModel.Container();
		System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(QC.QsprTestObjects.Loops.ScenarioConditionDialog));
		this.label1 = new System.Windows.Forms.Label();
		this.btnOK = new System.Windows.Forms.Button();
		this.btnCancel = new System.Windows.Forms.Button();
		this.groupBox2 = new System.Windows.Forms.GroupBox();
		this.formulaBuilderUC1 = new QC.QsprTestObjects.TestConditions.FormulaBuilderUC();
		this.chkConditionActive = new System.Windows.Forms.CheckBox();
		this.ultraTreeView = new System.Windows.Forms.TreeView();
		this.imageList = new System.Windows.Forms.ImageList(this.components);
		this.btnNewCondition = new System.Windows.Forms.Button();
		this.btnDeleteCondition = new System.Windows.Forms.Button();
		this.btnSaveCondition = new System.Windows.Forms.Button();
		this.groupBox1 = new System.Windows.Forms.GroupBox();
		this.createCondition = new QC.QsprTestObjects.TestConditions.CreateConditionUC();
		this.radioMet = new System.Windows.Forms.RadioButton();
		this.radioNotMet = new System.Windows.Forms.RadioButton();
		this.btnDeleteAllConditions = new System.Windows.Forms.Button();
		this.groupBox2.SuspendLayout();
		this.groupBox1.SuspendLayout();
		base.SuspendLayout();
		this.label1.AutoSize = true;
		this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.label1.ForeColor = System.Drawing.SystemColors.ControlText;
		this.label1.Location = new System.Drawing.Point(5, 705);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(185, 13);
		this.label1.TabIndex = 0;
		this.label1.Text = "Loop will break only if condition is:";
		this.btnOK.Location = new System.Drawing.Point(407, 710);
		this.btnOK.Name = "btnOK";
		this.btnOK.Size = new System.Drawing.Size(75, 23);
		this.btnOK.TabIndex = 2;
		this.btnOK.Text = "Ok";
		this.btnOK.UseVisualStyleBackColor = true;
		this.btnOK.Click += new System.EventHandler(btnOK_Click);
		this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
		this.btnCancel.Location = new System.Drawing.Point(326, 710);
		this.btnCancel.Name = "btnCancel";
		this.btnCancel.Size = new System.Drawing.Size(75, 23);
		this.btnCancel.TabIndex = 3;
		this.btnCancel.Text = "Cancel";
		this.btnCancel.UseVisualStyleBackColor = true;
		this.groupBox2.Controls.Add(this.formulaBuilderUC1);
		this.groupBox2.Location = new System.Drawing.Point(8, 484);
		this.groupBox2.Name = "groupBox2";
		this.groupBox2.Size = new System.Drawing.Size(474, 216);
		this.groupBox2.TabIndex = 1;
		this.groupBox2.TabStop = false;
		this.groupBox2.Text = "Formula Editor";
		this.formulaBuilderUC1.BackColor = System.Drawing.SystemColors.Window;
		this.formulaBuilderUC1.Expression = "";
		this.formulaBuilderUC1.Location = new System.Drawing.Point(8, 15);
		this.formulaBuilderUC1.Name = "formulaBuilderUC1";
		this.formulaBuilderUC1.Size = new System.Drawing.Size(458, 195);
		this.formulaBuilderUC1.TabIndex = 0;
		this.chkConditionActive.AutoSize = true;
		this.chkConditionActive.Checked = true;
		this.chkConditionActive.CheckState = System.Windows.Forms.CheckState.Checked;
		this.chkConditionActive.Location = new System.Drawing.Point(8, 724);
		this.chkConditionActive.Name = "chkConditionActive";
		this.chkConditionActive.Size = new System.Drawing.Size(103, 17);
		this.chkConditionActive.TabIndex = 5;
		this.chkConditionActive.Text = "Condition Active";
		this.chkConditionActive.UseVisualStyleBackColor = true;
		this.chkConditionActive.CheckedChanged += new System.EventHandler(chkConditionActive_CheckedChanged);
		this.ultraTreeView.Enabled = false;
		this.ultraTreeView.HideSelection = false;
		this.ultraTreeView.ImageIndex = 0;
		this.ultraTreeView.ImageList = this.imageList;
		this.ultraTreeView.Location = new System.Drawing.Point(8, 7);
		this.ultraTreeView.Name = "ultraTreeView";
		this.ultraTreeView.SelectedImageIndex = 0;
		this.ultraTreeView.Size = new System.Drawing.Size(474, 198);
		this.ultraTreeView.TabIndex = 6;
		this.ultraTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(ultraTreeView_AfterSelect);
		this.imageList.ImageStream = (System.Windows.Forms.ImageListStreamer)resources.GetObject("imageList.ImageStream");
		this.imageList.TransparentColor = System.Drawing.Color.Transparent;
		this.imageList.Images.SetKeyName(0, "folder-open.png");
		this.imageList.Images.SetKeyName(1, "folder-closed.png");
		this.imageList.Images.SetKeyName(2, "TestTreeTest.png");
		this.btnNewCondition.Location = new System.Drawing.Point(9, 239);
		this.btnNewCondition.Name = "btnNewCondition";
		this.btnNewCondition.Size = new System.Drawing.Size(99, 23);
		this.btnNewCondition.TabIndex = 1;
		this.btnNewCondition.Text = "New Condition";
		this.btnNewCondition.UseVisualStyleBackColor = true;
		this.btnNewCondition.Click += new System.EventHandler(btnNewCondition_Click);
		this.btnDeleteCondition.Enabled = false;
		this.btnDeleteCondition.Location = new System.Drawing.Point(114, 239);
		this.btnDeleteCondition.Name = "btnDeleteCondition";
		this.btnDeleteCondition.Size = new System.Drawing.Size(99, 23);
		this.btnDeleteCondition.TabIndex = 2;
		this.btnDeleteCondition.Text = "Delete Condition";
		this.btnDeleteCondition.UseVisualStyleBackColor = true;
		this.btnDeleteCondition.Click += new System.EventHandler(btnDeleteCondition_Click);
		this.btnSaveCondition.Enabled = false;
		this.btnSaveCondition.Location = new System.Drawing.Point(366, 239);
		this.btnSaveCondition.Name = "btnSaveCondition";
		this.btnSaveCondition.Size = new System.Drawing.Size(99, 23);
		this.btnSaveCondition.TabIndex = 3;
		this.btnSaveCondition.Text = "Save Condition";
		this.btnSaveCondition.UseVisualStyleBackColor = true;
		this.btnSaveCondition.Click += new System.EventHandler(btnSaveCondition_Click);
		this.groupBox1.Controls.Add(this.btnDeleteAllConditions);
		this.groupBox1.Controls.Add(this.btnSaveCondition);
		this.groupBox1.Controls.Add(this.btnDeleteCondition);
		this.groupBox1.Controls.Add(this.btnNewCondition);
		this.groupBox1.Controls.Add(this.createCondition);
		this.groupBox1.Location = new System.Drawing.Point(8, 211);
		this.groupBox1.Name = "groupBox1";
		this.groupBox1.Size = new System.Drawing.Size(474, 269);
		this.groupBox1.TabIndex = 0;
		this.groupBox1.TabStop = false;
		this.groupBox1.Text = "Condition Editor";
		this.createCondition.BackColor = System.Drawing.Color.White;
		this.createCondition.Condition = null;
		this.createCondition.Enabled = false;
		this.createCondition.Location = new System.Drawing.Point(2, 11);
		this.createCondition.Name = "createCondition";
		this.createCondition.Size = new System.Drawing.Size(468, 226);
		this.createCondition.TabIndex = 0;
		this.radioMet.AutoSize = true;
		this.radioMet.Checked = true;
		this.radioMet.Location = new System.Drawing.Point(193, 703);
		this.radioMet.Name = "radioMet";
		this.radioMet.Size = new System.Drawing.Size(42, 17);
		this.radioMet.TabIndex = 7;
		this.radioMet.TabStop = true;
		this.radioMet.Text = "met";
		this.radioMet.UseVisualStyleBackColor = true;
		this.radioNotMet.AutoSize = true;
		this.radioNotMet.Location = new System.Drawing.Point(238, 703);
		this.radioNotMet.Name = "radioNotMet";
		this.radioNotMet.Size = new System.Drawing.Size(60, 17);
		this.radioNotMet.TabIndex = 8;
		this.radioNotMet.Text = "not met";
		this.radioNotMet.UseVisualStyleBackColor = true;
		this.btnDeleteAllConditions.Location = new System.Drawing.Point(219, 239);
		this.btnDeleteAllConditions.Name = "btnDeleteAllConditions";
		this.btnDeleteAllConditions.Size = new System.Drawing.Size(123, 23);
		this.btnDeleteAllConditions.TabIndex = 5;
		this.btnDeleteAllConditions.Text = "Delete All Conditions";
		this.btnDeleteAllConditions.UseVisualStyleBackColor = true;
		this.btnDeleteAllConditions.Click += new System.EventHandler(btnDeleteAllConditions_Click);
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		this.AutoScroll = true;
		base.AutoScrollMargin = new System.Drawing.Size(0, 3);
		base.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
		this.BackColor = System.Drawing.Color.White;
		base.ClientSize = new System.Drawing.Size(500, 746);
		base.Controls.Add(this.radioNotMet);
		base.Controls.Add(this.radioMet);
		base.Controls.Add(this.btnCancel);
		base.Controls.Add(this.btnOK);
		base.Controls.Add(this.label1);
		base.Controls.Add(this.groupBox2);
		base.Controls.Add(this.chkConditionActive);
		base.Controls.Add(this.ultraTreeView);
		base.Controls.Add(this.groupBox1);
		base.Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
		this.MaximumSize = new System.Drawing.Size(518, 790);
		this.MinimumSize = new System.Drawing.Size(498, 100);
		base.Name = "LoopConditionDialog";
		base.ShowIcon = false;
		base.ShowInTaskbar = false;
		base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
		this.Text = "Loop Break Condition";
		base.Load += new System.EventHandler(ScenarioCondition_Load);
		this.groupBox2.ResumeLayout(false);
		this.groupBox1.ResumeLayout(false);
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
