fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Threading;
  10.  
  11. namespace WindowsFormsApplication7
  12. {
  13. public partial class Form1 : Form
  14. {
  15. #region Variables
  16.  
  17. double[] CurStat = new double[12];
  18. double[] TempStat = new double[12];
  19. const double ops = 0.0003;
  20.  
  21. #endregion
  22.  
  23. #region Intialization
  24. public Form1()
  25. {
  26.  
  27. InitializeComponent();
  28. for (int intial = 0; intial < 12; intial++)
  29. {
  30. CurStat[intial] = 0;
  31. TempStat[intial] = 0;
  32. }
  33.  
  34. }
  35. #endregion
  36.  
  37. #region test!!!!!!!!!!!!!!!!!!!!!!!!!
  38. private void button1_Click(object sender, EventArgs e)
  39. {
  40. bool f = true;
  41.  
  42. double c = Convert.ToDouble(textBox1.Text);
  43. double te = Convert.ToDouble(textBox2.Text);
  44.  
  45. Thread t1 = new Thread(MotorACur);
  46. Thread t2 = new Thread(MotorATemp);
  47.  
  48. Thread t3 = new Thread(MotorBCur);
  49. Thread t4 = new Thread(MotorBTemp);
  50.  
  51. Thread t5 = new Thread(MotorCCur);
  52. Thread t6 = new Thread(MotorCTemp);
  53.  
  54. Thread t7 = new Thread(MotorDCur);
  55. Thread t8 = new Thread(MotorDTemp);
  56.  
  57. Thread t9 = new Thread(MotorECur);
  58. Thread t10 = new Thread(MotorETemp);
  59.  
  60. Thread t11 = new Thread(MotorFCur);
  61. Thread t12 = new Thread(MotorFTemp);
  62.  
  63. Thread t13 = new Thread(MotorGCur);
  64. Thread t14 = new Thread(MotorGTemp);
  65.  
  66. Thread t15 = new Thread(MotorHCur);
  67. Thread t16 = new Thread(MotorHTemp);
  68.  
  69. t1.Start((double)c);
  70. t2.Start((double)te);
  71.  
  72. t3.Start((double)c);
  73. t4.Start((double)te);
  74.  
  75. t5.Start((double)c);
  76. t6.Start((double)te);
  77.  
  78. t7.Start((double)c);
  79. t8.Start((double)te);
  80.  
  81. t9.Start((double)c);
  82. t10.Start((double)te);
  83.  
  84. t11.Start((double)c);
  85. t12.Start((double)te);
  86.  
  87. t13.Start((double)c);
  88. t14.Start((double)te);
  89.  
  90. t15.Start((double)c);
  91. t16.Start((double)te);
  92.  
  93. t1.Join();
  94. t2.Join();
  95.  
  96. t3.Join();
  97. t4.Join();
  98.  
  99. t5.Join();
  100. t6.Join();
  101.  
  102. t7.Join();
  103. t8.Join();
  104.  
  105. t9.Join();
  106. t10.Join();
  107.  
  108. t11.Join();
  109. t12.Join();
  110.  
  111. t13.Join();
  112. t14.Join();
  113.  
  114. t15.Join();
  115. t16.Join();
  116.  
  117. }
  118. #endregion
  119.  
  120. #region Camera
  121. #endregion
  122.  
  123. #region Receiving data
  124. #endregion
  125.  
  126. #region Sending Data
  127. #endregion
  128.  
  129.  
  130. #region MotorA
  131. #region Temperature
  132. private void MotorATemp(object obj)
  133. {
  134. double val = (double)obj;
  135. bool f = false;
  136.  
  137. if (val > TempStat[0])
  138. f = false;
  139. else
  140. f = true;
  141.  
  142. while ((!f && val > TempStat[0]) || (f && val < TempStat[0]))
  143. {
  144. if (f)
  145. TempStat[0] -= ops;
  146. else
  147. TempStat[0] += ops;
  148.  
  149. MotorA.SetPointerValue("Pointer1", TempStat[0]);
  150. }
  151. }
  152. #endregion
  153.  
  154. #region Current
  155.  
  156. private void MotorACur(object obj)
  157. {
  158. double val = (double)obj;
  159. if (val > 12)
  160. val = 12;
  161. if (val < 0)
  162. val = 0;
  163.  
  164. bool f = false;
  165.  
  166. if (val > CurStat[0])
  167. f = false;
  168. else
  169. f = true;
  170.  
  171. while ((!f && val > CurStat[0]) || (f && val < CurStat[0]))
  172. {
  173. if (f)
  174. CurStat[0] -= ops;
  175. else
  176. CurStat[0] += ops;
  177.  
  178. MotorA.SetPointerValue("Pointer2", CurStat[0]);
  179. //MotorA.Refresh();
  180. //MotorA.Update();
  181. }
  182. }
  183.  
  184. #endregion
  185. #endregion
  186.  
  187. #region MotorB
  188. #region Temperature
  189.  
  190. private void MotorBTemp(object obj)
  191. {
  192. double val = (double)obj;
  193. bool f = false;
  194.  
  195. if (val > TempStat[1])
  196. f = false;
  197. else
  198. f = true;
  199.  
  200. while ((!f && val > TempStat[1]) || (f && val < TempStat[1]))
  201. {
  202. if (f)
  203. TempStat[1] -= ops;
  204. else
  205. TempStat[1] += ops;
  206.  
  207. MotorB.SetPointerValue("Pointer1", TempStat[1]);
  208. }
  209. }
  210.  
  211. #endregion
  212. #region Current
  213. private void MotorBCur(object obj)
  214. {
  215. double val = (double)obj;
  216. if (val > 12)
  217. val = 12;
  218. if (val < 0)
  219. val = 0;
  220.  
  221. bool f = false;
  222.  
  223. if (val > CurStat[1])
  224. f = false;
  225. else
  226. f = true;
  227.  
  228. while ((!f && val > CurStat[1]) || (f && val < CurStat[1]))
  229. {
  230. if (f)
  231. CurStat[1] -= ops;
  232. else
  233. CurStat[1] += ops;
  234.  
  235. MotorA.SetPointerValue("Pointer", CurStat[1]);
  236. //MotorB.Refresh();
  237. //MotorB.Update();
  238. }
  239.  
  240. }
  241. #endregion
  242. #endregion
  243.  
  244. #region MotorC
  245. #region Temperature
  246.  
  247. private void MotorCTemp(object obj)
  248. {
  249. double val = (double)obj;
  250. bool f = false;
  251.  
  252. if (val > TempStat[2])
  253. f = false;
  254. else
  255. f = true;
  256.  
  257. while ((!f && val > TempStat[2]) || (f && val < TempStat[2]))
  258. {
  259. if (f)
  260. TempStat[2] -= ops;
  261. else
  262. TempStat[2] += ops;
  263.  
  264. MotorC.SetPointerValue("Pointer1", TempStat[2]);
  265. }
  266. }
  267.  
  268. #endregion
  269. #region Current
  270. private void MotorCCur(object obj)
  271. {
  272. double val = (double)obj;
  273. if (val > 12)
  274. val = 12;
  275. if (val < 0)
  276. val = 0;
  277.  
  278. bool f = false;
  279.  
  280. if (val > CurStat[2])
  281. f = false;
  282. else
  283. f = true;
  284.  
  285. while ((!f && val > CurStat[2]) || (f && val < CurStat[2]))
  286. {
  287. if (f)
  288. CurStat[2] -= ops;
  289. else
  290. CurStat[2] += ops;
  291.  
  292. MotorC.SetPointerValue("Pointer2", CurStat[2]);
  293. }
  294.  
  295. }
  296. #endregion
  297. #endregion
  298.  
  299. #region MotorD
  300. #region Temperature
  301.  
  302. private void MotorDTemp(object obj)
  303. {
  304. double val = (double)obj;
  305. bool f = false;
  306.  
  307. if (val > TempStat[3])
  308. f = false;
  309. else
  310. f = true;
  311.  
  312. while ((!f && val > TempStat[3]) || (f && val < TempStat[3]))
  313. {
  314. if (f)
  315. TempStat[3] -= ops;
  316. else
  317. TempStat[3] += ops;
  318.  
  319. MotorD.SetPointerValue("Pointer1", TempStat[3]);
  320. }
  321. }
  322.  
  323. #endregion
  324. #region Current
  325. private void MotorDCur(object obj)
  326. {
  327. double val = (double)obj;
  328. if (val > 12)
  329. val = 12;
  330. if (val < 0)
  331. val = 0;
  332.  
  333. bool f = false;
  334.  
  335. if (val > CurStat[3])
  336. f = false;
  337. else
  338. f = true;
  339.  
  340. while ((!f && val > CurStat[3]) || (f && val < CurStat[3]))
  341. {
  342. if (f)
  343. CurStat[3] -= ops;
  344. else
  345. CurStat[3] += ops;
  346.  
  347. MotorD.SetPointerValue("Pointer2", CurStat[3]);
  348. }
  349.  
  350. }
  351. #endregion
  352. #endregion
  353.  
  354. #region MotorE
  355. #region Temperature
  356.  
  357. private void MotorETemp(object obj)
  358. {
  359. double val = (double)obj;
  360. bool f = false;
  361.  
  362. if (val > TempStat[4])
  363. f = false;
  364. else
  365. f = true;
  366.  
  367. while ((!f && val > TempStat[4]) || (f && val < TempStat[4]))
  368. {
  369. if (f)
  370. TempStat[4] -= ops;
  371. else
  372. TempStat[4] += ops;
  373.  
  374. MotorE.SetPointerValue("Pointer1", TempStat[4]);
  375. }
  376. }
  377.  
  378. #endregion
  379. #region Current
  380. private void MotorECur(object obj)
  381. {
  382. double val = (double)obj;
  383. if (val > 12)
  384. val = 12;
  385. if (val < 0)
  386. val = 0;
  387.  
  388. bool f = false;
  389.  
  390. if (val > CurStat[4])
  391. f = false;
  392. else
  393. f = true;
  394.  
  395. while ((!f && val > CurStat[4]) || (f && val < CurStat[4]))
  396. {
  397. if (f)
  398. CurStat[4] -= ops;
  399. else
  400. CurStat[4] += ops;
  401.  
  402. MotorE.SetPointerValue("Pointer2", CurStat[4]);
  403. }
  404.  
  405. }
  406. #endregion
  407. #endregion
  408.  
  409. #region MotorF
  410. #region Temperature
  411.  
  412. private void MotorFTemp(object obj)
  413. {
  414. double val = (double)obj;
  415. bool f = false;
  416.  
  417. if (val > TempStat[5])
  418. f = false;
  419. else
  420. f = true;
  421.  
  422. while ((!f && val > TempStat[5]) || (f && val < TempStat[5]))
  423. {
  424. if (f)
  425. TempStat[5] -= ops;
  426. else
  427. TempStat[5] += ops;
  428.  
  429. MotorF.SetPointerValue("Pointer1", TempStat[5]);
  430. }
  431. }
  432.  
  433. #endregion
  434. #region Current
  435. private void MotorFCur(object obj)
  436. {
  437. double val = (double)obj;
  438. if (val > 12)
  439. val = 12;
  440. if (val < 0)
  441. val = 0;
  442.  
  443. bool f = false;
  444.  
  445. if (val > CurStat[5])
  446. f = false;
  447. else
  448. f = true;
  449.  
  450. while ((!f && val > CurStat[5]) || (f && val < CurStat[5]))
  451. {
  452. if (f)
  453. CurStat[5] -= ops;
  454. else
  455. CurStat[5] += ops;
  456.  
  457. MotorF.SetPointerValue("Pointer2", CurStat[5]);
  458. }
  459.  
  460. }
  461. #endregion
  462. #endregion
  463.  
  464. #region MotorG
  465. #region Temperature
  466.  
  467. private void MotorGTemp(object obj)
  468. {
  469. double val = (double)obj;
  470. bool f = false;
  471.  
  472. if (val > TempStat[6])
  473. f = false;
  474. else
  475. f = true;
  476.  
  477. while ((!f && val > TempStat[6]) || (f && val < TempStat[6]))
  478. {
  479. if (f)
  480. TempStat[6] -= ops;
  481. else
  482. TempStat[6] += ops;
  483.  
  484. MotorG.SetPointerValue("Pointer1", TempStat[6]);
  485. }
  486. }
  487.  
  488. #endregion
  489. #region Current
  490. private void MotorGCur(object obj)
  491. {
  492. double val = (double)obj;
  493. if (val > 12)
  494. val = 12;
  495. if (val < 0)
  496. val = 0;
  497.  
  498. bool f = false;
  499.  
  500. if (val > CurStat[6])
  501. f = false;
  502. else
  503. f = true;
  504.  
  505. while ((!f && val > CurStat[6]) || (f && val < CurStat[6]))
  506. {
  507. if (f)
  508. CurStat[6] -= ops;
  509. else
  510. CurStat[6] += ops;
  511.  
  512. MotorG.SetPointerValue("Pointer2", CurStat[6]);
  513. }
  514.  
  515. }
  516. #endregion
  517. #endregion
  518.  
  519. #region MotorH
  520. #region Temperature
  521.  
  522. private void MotorHTemp(object obj)
  523. {
  524. double val = (double)obj;
  525. bool f = false;
  526.  
  527. if (val > TempStat[7])
  528. f = false;
  529. else
  530. f = true;
  531.  
  532. while ((!f && val > TempStat[7]) || (f && val < TempStat[7]))
  533. {
  534. if (f)
  535. TempStat[7] -= ops;
  536. else
  537. TempStat[7] += ops;
  538.  
  539. MotorH.SetPointerValue("Pointer1", TempStat[7]);
  540. }
  541. }
  542.  
  543. #endregion
  544. #region Current
  545. private void MotorHCur(object obj)
  546. {
  547. double val = (double)obj;
  548. if (val > 12)
  549. val = 12;
  550. if (val < 0)
  551. val = 0;
  552.  
  553. bool f = false;
  554.  
  555. if (val > CurStat[7])
  556. f = false;
  557. else
  558. f = true;
  559.  
  560. while ((!f && val > CurStat[7]) || (f && val < CurStat[7]))
  561. {
  562. if (f)
  563. CurStat[7] -= ops;
  564. else
  565. CurStat[7] += ops;
  566.  
  567. MotorH.SetPointerValue("Pointer2", CurStat[7]);
  568. }
  569.  
  570. }
  571. #endregion
  572. #endregion
  573.  
  574. }
  575. }
  576.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(4,14): error CS0234: The type or namespace name `Data' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(8,14): error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?
Compilation failed: 2 error(s), 0 warnings
stdout
Standard output is empty