1: private int BulkScriptIndex = 0;
2: private bool Pass1 = true;
3:
4: public Form1()
5: {
6: InitializeComponent();
7: LoadScriptManifest();
8: if (true) // one time action only... pre-populates the scripts to save time.
9: {
10: timer1.Interval = 10;
11: timer1.Enabled = true;
12: }
13: this.txtStatus.Text = "Select a script from the list to work with.";
14: }
15:
16: private void BulkScriptItemConvert()
17: {
18: if (Pass1)
19: {
20: if (BulkScriptIndex == this.lvwScriptManifest.Items.Count)
21: {
22: this.lvwScriptManifest.Items[0].Selected = true;
23: this.lvwScriptManifest.Items[0].Focused = true;
24: return;
25: }
26: this.lvwScriptManifest.Items[BulkScriptIndex].Selected = true;
27: this.lvwScriptManifest.Items[BulkScriptIndex].Focused = true;
28: Pass1 = false;
29: timer1.Enabled = true;
30: return; // leave.. executes below after idle state has updated SelectedItems (etc) properties.
31: }
32:
33: GetScript();
34: if (this.txtCoverted.Document.TextContent.Trim().Length == 0)
35: {
36: ConvertScript();
37: UpdateScript();
38: }
39: this.lvwScriptManifest.Items[BulkScriptIndex].Selected = false;
40: BulkScriptIndex++;
41: Pass1 = true;
42: timer1.Enabled = true;
43: }
44:
45: private void timer1_Tick(object sender, EventArgs e)
46: {
47: timer1.Enabled = false;
48: BulkScriptItemConvert();
49: }