...extalos\source\repos\WpfApp1\WpfApp1\[Link].
cs 1
1 using System;
2 using [Link];
3 using [Link];
4 using [Link];
5 using [Link];
6 using [Link];
7 using [Link];
8 using [Link];
9 using [Link];
10 using [Link];
11 using [Link];
12 using [Link];
13 using [Link];
14 using [Link];
15 using [Link];
16
17
18 namespace WpfApp1
19 {
20 /// <summary>
21 /// Interaction logic for [Link]
22 /// </summary>
23 public partial class MainWindow : Window
24 {
25 private readonly BackgroundWorker worker = new BackgroundWorker();
26 object state = new object[2];
27 string stateString;
28
29 public MainWindow()
30 {
31 InitializeComponent();
32 [Link] += Worker_DoWork;
33 [Link] += Worker_RunWorkerCompleted;
34 [Link] += Worker_ProgressChanged;
35 [Link] = true;
36 [Link] = true;
37 [Link] = "Stopped";
38
39 }
40
41 private void Worker_ProgressChanged(object sender,
ProgressChangedEventArgs e)
42 {
43 [Link] = [Link];
44 [Link] = (([Link] as object[])[1].ToString());
45 [Link] = (([Link] as object[])[0]);
46 }
47
48 private void Worker_RunWorkerCompleted(object sender,
RunWorkerCompletedEventArgs e)
49 {
50 if ([Link] == true)
51 {
52 [Link] = "Canceled!";
53 }
54 else if ([Link] != null)
...extalos\source\repos\WpfApp1\WpfApp1\[Link] 2
55 {
56 [Link] = "Error: " + [Link];
57 }
58 else
59 {
60 [Link] = "Done!";
61 }
62
63 }
64
65 private void Worker_DoWork(object sender, DoWorkEventArgs e)
66 {
67 for (int i = 0; i <= 100; i++)
68 {
69 [Link](i,state);
70 for (int j = 0; j <= 500000; j++)
71 {
72 [Link] = j;
73
74 if ([Link])
75 {
76 [Link] = true;
77 state = new object[2] { stateString, j };
78 stateString = "Cancelation pending";
79 break;
80 }
81 else
82 {
83 stateString = "Running";
84 }
85 }
86 }
87 }
88
89 private void Button_Click(object sender, RoutedEventArgs e)
90 {
91 if ([Link] == true)
92 {
93 [Link] = false;
94 [Link]();
95 }
96 else
97 {
98 [Link] = true;
99 [Link]();
100 }
101 }
102 }
103 }
104