This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
/
Form1.cs
58 lines (54 loc) · 2.16 KB
/
Form1.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using DevExpress.XtraSplashScreen;
namespace AsynchronousFindInTreeList {
public partial class Form1 : Form {
AsyncSearchHelper helper;
public Form1() {
InitializeComponent();
helper = new AsyncSearchHelper(treeList1);
helper.AsyncOperationIsComplete += new EventHandler(helper_AsyncOperationIsComplete);
}
void helper_AsyncOperationIsComplete(object sender, EventArgs e) {
if(SplashScreenManager.Default != null)
SplashScreenManager.CloseForm();
}
private void Form1_Load(object sender, EventArgs e) {
DataTable dt = DataHelper.GetDataTable();
if(dt.Rows.Count == 0) {
DialogResult result = MessageBox.Show("Would you like to generate data?", "DataTable is empty", MessageBoxButtons.YesNo);
if(result == System.Windows.Forms.DialogResult.Yes) {
SplashScreenManager.ShowForm(typeof(SplashScreen1));
//DataHelper.GenegateData(records_count, interval_for_new_root_node);
DataHelper.GenegateData(5000, 20);
CustomizeTreeListFields();
treeList1.DataSource = DataHelper.GetDataTable();
SplashScreenManager.CloseForm();
}
else {
MessageBox.Show("DataTable is empty");
}
}
else {
CustomizeTreeListFields();
treeList1.DataSource = dt;
}
}
void CustomizeTreeListFields() {
treeList1.KeyFieldName = "ID";
treeList1.ParentFieldName = "PARENTID";
treeList1.ImageIndexFieldName = "IMAGEINDEX";
}
private void simpleButton1_Click(object sender, EventArgs e) {
SplashScreenManager.ShowForm(typeof(WaitForm1));
helper.AsyncSearch(DataHelper.GetDataTable(), textEdit1.Text);
}
}
}