using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Telerik.WinControls.UI;

namespace TelerikTestSelf
{
	public partial class MainForm : Form
	{
		public MainForm()
		{
			InitializeComponent();
		}

		private List<TestParItem> items = new List<TestParItem>();

		private void MainForm_Load(object sender, EventArgs e)
		{
			var col = radGridView1.Columns["colTestType"] as GridViewComboBoxColumn;
			col.ValueMember = "Value";
			col.DisplayMember = "Display";
			col.DataSource = ((TestType[])Enum.GetValues(typeof(TestType))).Select(v => new { Value = v, Display = v.ToString() }).ToList();
			radGridView1.Relations.AddSelfReference(radGridView1.MasterTemplate, "colGridID", "colGridParentID");

			items.Add(new TestParItem() { PosIndex = 0, TestType = TestType.AbsPos, R = 5, Fi = 45, Min = 11, Max = 21, Comment = "test 1", Disabled = false, GridID = 1, GridParentID = 0 });
			items.Add(new TestParItem() { PosIndex = 1, TestType = TestType.RelPos, R = 6, Fi = 46, Min = 12, Max = 22, Comment = "test 2", Disabled = false, GridID = 2, GridParentID = 0 });
			items.Add(new TestParItem() { PosIndex = 2, TestType = TestType.AbsPos, R = 7, Fi = 47, Min = 13, Max = 23, Comment = "test 3", Disabled = true, GridID = 3, GridParentID = 0 });
			items.Add(new TestParItem() { PosIndex = 3, TestType = TestType.TestSub, R = 8, Fi = 48, Min = 14, Max = 24, Comment = "test 4", Disabled = false, GridID = 4, GridParentID = 0 });
			items.Add(new TestParItem() { PosIndex = 4, TestType = TestType.TestSub, R = 9, Fi = 49, Min = 15, Max = 25, Comment = "test 5", Disabled = false, GridID = 5, GridParentID = 0 });


			items.Add(new TestParItem() { PosIndex = 3, TestType = TestType.Diameter, R = 8, Fi = 48, Min = 14, Max = 24, Comment = "test 4", Disabled = false, GridID = 41, GridParentID = 4 });
			items.Add(new TestParItem() { PosIndex = 3, TestType = TestType.Height, R = 8, Fi = 48, Min = 14, Max = 24, Comment = "test 4", Disabled = false, GridID = 42, GridParentID = 4 });
			items.Add(new TestParItem() { PosIndex = 3, TestType = TestType.Angle, R = 8, Fi = 48, Min = 14, Max = 24, Comment = "test 4", Disabled = false, GridID = 43, GridParentID = 4 });
			items.Add(new TestParItem() { PosIndex = 4, TestType = TestType.Diameter, R = 8, Fi = 48, Min = 14, Max = 24, Comment = "test 5", Disabled = false, GridID = 51, GridParentID = 5 });
			items.Add(new TestParItem() { PosIndex = 4, TestType = TestType.Height, R = 8, Fi = 48, Min = 14, Max = 24, Comment = "test 5", Disabled = false, GridID = 52, GridParentID = 5 });
			items.Add(new TestParItem() { PosIndex = 4, TestType = TestType.Angle, R = 8, Fi = 48, Min = 14, Max = 24, Comment = "test 5", Disabled = false, GridID = 53, GridParentID = 5 });


			radGridView1.DataSource = items;
		}
	}
}
