AtmRobot4LP.xaml.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  1. using Aitex.Core.Common;
  2. using Aitex.Sorter.Common;
  3. using System;
  4. using System.Globalization;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Input;
  8. using System.Windows.Media;
  9. using MECF.Framework.Common.Equipment;
  10. namespace Aitex.Sorter.UI.Controls
  11. {
  12. /// <summary>
  13. /// AtmRobot.xaml 的交互逻辑
  14. /// </summary>
  15. public partial class AtmRobot4LP : UserControl
  16. {
  17. private const int ms = 300;
  18. public int RotateAngle
  19. {
  20. get { return (int)GetValue(RotateAngleProperty); }
  21. set { SetValue(RotateAngleProperty, value); }
  22. }
  23. // Using a DependencyProperty as the backing store for RotateAngel. This enables animation, styling, binding, etc...
  24. public static readonly DependencyProperty RotateAngleProperty =
  25. DependencyProperty.Register("RotateAngel", typeof(int), typeof(AtmRobot4LP), new PropertyMetadata(0));
  26. public int RobotWidth
  27. {
  28. get { return (int)GetValue(RobotWidthProperty); }
  29. set { SetValue(RobotWidthProperty, value); }
  30. }
  31. // Using a DependencyProperty as the backing store for RobotWidth. This enables animation, styling, binding, etc...
  32. public static readonly DependencyProperty RobotWidthProperty =
  33. DependencyProperty.Register("RobotWidth", typeof(int), typeof(AtmRobot4LP), new PropertyMetadata(0));
  34. public int RobotHeight
  35. {
  36. get { return (int)GetValue(RobotHeightProperty); }
  37. set { SetValue(RobotHeightProperty, value); }
  38. }
  39. // Using a DependencyProperty as the backing store for RobotHeight. This enables animation, styling, binding, etc...
  40. public static readonly DependencyProperty RobotHeightProperty =
  41. DependencyProperty.Register("RobotHeight", typeof(int), typeof(AtmRobot4LP), new PropertyMetadata(60));
  42. public int DockerWidth
  43. {
  44. get { return (int)GetValue(DockerWidthProperty); }
  45. set { SetValue(DockerWidthProperty, value); }
  46. }
  47. // Using a DependencyProperty as the backing store for DockerWidth. This enables animation, styling, binding, etc...
  48. public static readonly DependencyProperty DockerWidthProperty =
  49. DependencyProperty.Register("DockerWidth", typeof(int), typeof(AtmRobot4LP), new PropertyMetadata(0));
  50. public WaferInfo Wafer1
  51. {
  52. get { return (WaferInfo)GetValue(Wafer1Property); }
  53. set { SetValue(Wafer1Property, value); }
  54. }
  55. // Using a DependencyProperty as the backing store for WaferItem. This enables animation, styling, binding, etc...
  56. public static readonly DependencyProperty Wafer1Property =
  57. DependencyProperty.Register("Wafer1", typeof(WaferInfo), typeof(AtmRobot4LP), new PropertyMetadata(null));
  58. public WaferInfo Wafer2
  59. {
  60. get { return (WaferInfo)GetValue(Wafer2Property); }
  61. set { SetValue(Wafer2Property, value); }
  62. }
  63. // Using a DependencyProperty as the backing store for WaferItem. This enables animation, styling, binding, etc...
  64. public static readonly DependencyProperty Wafer2Property =
  65. DependencyProperty.Register("Wafer2", typeof(WaferInfo), typeof(AtmRobot4LP), new PropertyMetadata(null));
  66. public ModuleName Station
  67. {
  68. get { return (ModuleName)GetValue(StationProperty); }
  69. set { SetValue(StationProperty, value); }
  70. }
  71. // Using a DependencyProperty as the backing store for Station. This enables animation, styling, binding, etc...
  72. public static readonly DependencyProperty StationProperty =
  73. DependencyProperty.Register("Station", typeof(ModuleName), typeof(AtmRobot4LP), new PropertyMetadata(ModuleName.Robot));
  74. public ICommand Command
  75. {
  76. get { return (ICommand)GetValue(CommandProperty); }
  77. set { SetValue(CommandProperty, value); }
  78. }
  79. // Using a DependencyProperty as the backing store for Command. This enables animation, styling, binding, etc...
  80. public static readonly DependencyProperty CommandProperty =
  81. DependencyProperty.Register("Command", typeof(ICommand), typeof(AtmRobot4LP), new PropertyMetadata(null));
  82. public ModuleName RobotBladeTarget
  83. {
  84. get { return (ModuleName)GetValue(RobotBladeTargetProperty); }
  85. set { SetValue(RobotBladeTargetProperty, value); }
  86. }
  87. public static readonly DependencyProperty RobotBladeTargetProperty =
  88. DependencyProperty.Register("RobotBladeTarget", typeof(ModuleName), typeof(AtmRobot4LP), new FrameworkPropertyMetadata(ModuleName.System, FrameworkPropertyMetadataOptions.AffectsRender));
  89. public AtmRobot4LP()
  90. {
  91. InitializeComponent();
  92. root.DataContext = this;
  93. canvas1.Rotate(90);
  94. canvas2.Rotate(180);
  95. canvas3.Rotate(180);
  96. canvas23.Rotate(180);
  97. Blade1Status = BladeStatus4LP.Retract;
  98. Blade2Status = BladeStatus4LP.Retract;
  99. }
  100. protected override void OnRender(DrawingContext drawingContext)
  101. {
  102. base.OnRender(drawingContext);
  103. //var text = new FormattedText(RobotBladeTarget.ToString(), CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, new Typeface("Verdana"), 10, Brushes.Black);
  104. //drawingContext.DrawText(text, new Point(10, 0));
  105. if (Blade1Status == BladeStatus4LP.Extend && (RobotBladeTarget == ModuleName.System || RobotBladeTarget == ModuleName.Robot))
  106. {
  107. RetractBlade1();
  108. RetractBlade2();
  109. }
  110. if (Blade1Status == BladeStatus4LP.Retract && RobotBladeTarget != ModuleName.System && RobotBladeTarget != ModuleName.Robot)
  111. {
  112. ExtendBlade1();
  113. ExtendBlade2();
  114. }
  115. if (Blade1Status == BladeStatus4LP.Retract && Blade2Status == BladeStatus4LP.Retract)
  116. {
  117. MoveToHome();
  118. return;
  119. }
  120. if (Blade1Status == BladeStatus4LP.Extend || Blade2Status == BladeStatus4LP.Extend)
  121. {
  122. MoveRobot(RobotBladeTarget);
  123. }
  124. }
  125. private bool MoveRobot(ModuleName chamberSet)
  126. {
  127. switch (chamberSet)
  128. {
  129. case ModuleName.System:
  130. break;
  131. case ModuleName.LP1:
  132. return MoveToLP1();
  133. case ModuleName.LP2:
  134. return MoveToLP2();
  135. case ModuleName.LP3:
  136. return MoveToLP3();
  137. case ModuleName.LP4:
  138. return MoveToLP4();
  139. case ModuleName.Robot:
  140. return MoveToHome();
  141. case ModuleName.Aligner:
  142. return MoveToAligner();
  143. case ModuleName.Upender:
  144. return MoveToInvertion();
  145. default:
  146. break;
  147. }
  148. return false;
  149. }
  150. public RobotPostion4LP CurrentPosition
  151. {
  152. get; set;
  153. }
  154. public BladeStatus4LP Blade1Status
  155. {
  156. get; set;
  157. }
  158. public BladeStatus4LP Blade2Status
  159. {
  160. get; set;
  161. }
  162. private void MenuItem_Click(object sender, RoutedEventArgs e)
  163. {
  164. var cmd = ((MenuItem)sender).Tag;
  165. Command.Execute(new[] { Station.ToString(), cmd });
  166. }
  167. private bool MoveToLP1()
  168. {
  169. switch (CurrentPosition)
  170. {
  171. case RobotPostion4LP.Home:
  172. HomeToLP1();
  173. return true;
  174. case RobotPostion4LP.LP1:
  175. break;
  176. case RobotPostion4LP.LP2:
  177. LP2ToLP1();
  178. return true;
  179. case RobotPostion4LP.LP3:
  180. LP3ToLP1();
  181. return true;
  182. case RobotPostion4LP.LP4:
  183. LP4ToLP1();
  184. return true;
  185. case RobotPostion4LP.Invertion:
  186. InvertionToLP1();
  187. return true;
  188. case RobotPostion4LP.Aligner:
  189. AlignerToLP1();
  190. return true;
  191. default:
  192. break;
  193. }
  194. return false;
  195. }
  196. private bool MoveToLP2()
  197. {
  198. switch (CurrentPosition)
  199. {
  200. case RobotPostion4LP.Home:
  201. HomeToLP2();
  202. return true;
  203. case RobotPostion4LP.LP1:
  204. LP1ToLP2();
  205. return true;
  206. case RobotPostion4LP.LP2:
  207. break;
  208. case RobotPostion4LP.LP3:
  209. LP3ToLP2();
  210. return true;
  211. case RobotPostion4LP.LP4:
  212. LP4ToLP2();
  213. return true;
  214. case RobotPostion4LP.Invertion:
  215. InvertionToLP2();
  216. return true;
  217. case RobotPostion4LP.Aligner:
  218. AlignerToLP2();
  219. return true;
  220. default:
  221. break;
  222. }
  223. return false;
  224. }
  225. private bool MoveToLP3()
  226. {
  227. switch (CurrentPosition)
  228. {
  229. case RobotPostion4LP.Home:
  230. HomeToLP3();
  231. return true;
  232. case RobotPostion4LP.LP1:
  233. LP1ToLP3();
  234. return true;
  235. case RobotPostion4LP.LP2:
  236. LP2ToLP3();
  237. return true;
  238. case RobotPostion4LP.LP3:
  239. break;
  240. case RobotPostion4LP.LP4:
  241. LP4ToLP3();
  242. return true;
  243. case RobotPostion4LP.Invertion:
  244. InvertionToLP3();
  245. return true;
  246. case RobotPostion4LP.Aligner:
  247. AlignerToLP3();
  248. return true;
  249. default:
  250. break;
  251. }
  252. return false;
  253. }
  254. private bool MoveToLP4()
  255. {
  256. switch (CurrentPosition)
  257. {
  258. case RobotPostion4LP.Home:
  259. HomeToLP4();
  260. return true;
  261. case RobotPostion4LP.LP1:
  262. LP1ToLP4();
  263. return true;
  264. case RobotPostion4LP.LP2:
  265. LP2ToLP4();
  266. return true;
  267. case RobotPostion4LP.LP3:
  268. LP3ToLP4();
  269. return true;
  270. case RobotPostion4LP.LP4:
  271. break;
  272. case RobotPostion4LP.Invertion:
  273. InvertionToLP4();
  274. return true;
  275. case RobotPostion4LP.Aligner:
  276. AlignerToLP4();
  277. return true;
  278. default:
  279. break;
  280. }
  281. return false;
  282. }
  283. private bool MoveToInvertion()
  284. {
  285. switch (CurrentPosition)
  286. {
  287. case RobotPostion4LP.Home:
  288. HomeToInvertion();
  289. return true;
  290. case RobotPostion4LP.LP1:
  291. LP1ToInvertion();
  292. break;
  293. case RobotPostion4LP.LP2:
  294. LP2ToInvertion();
  295. return true;
  296. case RobotPostion4LP.LP3:
  297. LP3ToInvertion();
  298. return true;
  299. case RobotPostion4LP.LP4:
  300. LP4ToInvertion();
  301. return true;
  302. case RobotPostion4LP.Aligner:
  303. AlignerToInvertion();
  304. return true;
  305. case RobotPostion4LP.Invertion:
  306. break;
  307. default:
  308. break;
  309. }
  310. return false;
  311. }
  312. private bool MoveToAligner()
  313. {
  314. switch (CurrentPosition)
  315. {
  316. case RobotPostion4LP.Home:
  317. HomeToAligner();
  318. return true;
  319. case RobotPostion4LP.LP1:
  320. LP1ToAligner();
  321. return true;
  322. case RobotPostion4LP.LP2:
  323. LP2ToAligner();
  324. return true;
  325. case RobotPostion4LP.LP3:
  326. LP3ToAligner();
  327. return true;
  328. case RobotPostion4LP.LP4:
  329. LP4ToAligner();
  330. return true;
  331. case RobotPostion4LP.Invertion:
  332. InvertionToAligner();
  333. return true;
  334. case RobotPostion4LP.Aligner:
  335. break;
  336. default:
  337. break;
  338. }
  339. return false;
  340. }
  341. private bool MoveToHome()
  342. {
  343. switch (CurrentPosition)
  344. {
  345. case RobotPostion4LP.Home:
  346. break;
  347. case RobotPostion4LP.LP1:
  348. LP1ToHome();
  349. return true;
  350. case RobotPostion4LP.LP2:
  351. LP2ToHome();
  352. return true;
  353. case RobotPostion4LP.Aligner:
  354. AlignerToHome();
  355. return true;
  356. default:
  357. break;
  358. }
  359. return false;
  360. }
  361. private void ExtendBlade1()
  362. {
  363. canvas3.Rotate(0, true, ms);
  364. Blade1Status = BladeStatus4LP.Extend;
  365. }
  366. private void RetractBlade1()
  367. {
  368. canvas3.Rotate(180, true, ms);
  369. Blade1Status = BladeStatus4LP.Retract;
  370. }
  371. private void ExtendBlade2()
  372. {
  373. canvas23.Rotate(0, true, ms);
  374. Blade2Status = BladeStatus4LP.Extend;
  375. }
  376. private void RetractBlade2()
  377. {
  378. canvas23.Rotate(180, true, ms);
  379. Blade2Status = BladeStatus4LP.Retract;
  380. }
  381. private void RetractBlade()
  382. {
  383. canvas3.Rotate(180, true);
  384. canvas23.Rotate(180, true);
  385. }
  386. private void ExtendBlade(int angle)
  387. {
  388. canvas3.Rotate(angle, true);
  389. canvas23.Rotate(angle, true);
  390. }
  391. private void HomeToLP1()
  392. {
  393. ToLP1Start(ToLP1End);
  394. }
  395. private void LP1ToAligner()
  396. {
  397. ToLP1Start(() => ToAlignerStart(ToAlignerEnd));
  398. }
  399. private void LP3ToAligner()
  400. {
  401. ToLP3Start(() => ToAlignerStart(ToAlignerEnd));
  402. }
  403. private void LP4ToAligner()
  404. {
  405. ToLP4Start(() => ToAlignerStart(ToAlignerEnd));
  406. }
  407. private void InvertionToAligner()
  408. {
  409. ToAlignerStart(ToAlignerEnd);
  410. }
  411. private void LP1ToLP2()
  412. {
  413. ToLP1Start(() => ToLP2Start(ToLP2End));
  414. }
  415. private void LP3ToLP2()
  416. {
  417. ToLP3Start(() => ToLP2Start(ToLP2End));
  418. }
  419. private void LP4ToLP2()
  420. {
  421. ToLP4Start(() => ToLP2Start(ToLP2End));
  422. }
  423. private void HomeToLP2()
  424. {
  425. ToLP2Start(ToLP2End);
  426. }
  427. private void HomeToLP3()
  428. {
  429. ToLP3Start(ToLP3End);
  430. }
  431. private void LP1ToLP3()
  432. {
  433. ToLP1Start(() => ToLP3Start(ToLP3End));
  434. }
  435. private void LP2ToLP3()
  436. {
  437. ToLP2Start(() => ToLP3Start(ToLP3End));
  438. }
  439. private void LP4ToLP3()
  440. {
  441. ToLP4Start(() => ToLP3Start(ToLP3End));
  442. }
  443. private void HomeToLP4()
  444. {
  445. ToLP4Start(ToLP4End);
  446. }
  447. private void LP1ToLP4()
  448. {
  449. ToLP1Start(() => ToLP4Start(ToLP4End));
  450. }
  451. private void LP2ToLP4()
  452. {
  453. ToLP2Start(() => ToLP4Start(ToLP4End));
  454. }
  455. private void LP3ToLP4()
  456. {
  457. ToLP3Start(() => ToLP4Start(ToLP4End));
  458. }
  459. private void InvertionToLP1()
  460. {
  461. ToLP1Start(ToLP1End);
  462. }
  463. private void InvertionToLP2()
  464. {
  465. ToLP2Start(ToLP2End);
  466. }
  467. private void InvertionToLP3()
  468. {
  469. ToLP3Start(ToLP3End);
  470. }
  471. private void InvertionToLP4()
  472. {
  473. ToLP4Start(ToLP4End);
  474. }
  475. private void LP2ToLP1()
  476. {
  477. ToLP2Start(() => ToLP1Start(ToLP1End));
  478. }
  479. private void LP3ToLP1()
  480. {
  481. ToLP3Start(() => ToLP1Start(ToLP1End));
  482. }
  483. private void LP4ToLP1()
  484. {
  485. ToLP4Start(() => ToLP1Start(ToLP1End));
  486. }
  487. private void LP2ToAligner()
  488. {
  489. ToLP2Start(() =>
  490. {
  491. RetractBlade();
  492. ToAlignerStart(() =>
  493. {
  494. ExtendBlade(0);
  495. ToAlignerEnd();
  496. });
  497. });
  498. }
  499. private void HomeToAligner()
  500. {
  501. ToAlignerStart(ToAlignerEnd);
  502. }
  503. private void AlignerToLP1()
  504. {
  505. ToAlignerStart(() => ToLP1Start(ToLP1End));
  506. }
  507. private void AlignerToLP2()
  508. {
  509. ToAlignerStart(
  510. () =>
  511. {
  512. RetractBlade();
  513. ToLP2Start(() =>
  514. {
  515. ExtendBlade(90);
  516. ToLP2End();
  517. });
  518. }
  519. );
  520. }
  521. private void AlignerToLP3()
  522. {
  523. ToAlignerStart(() => ToLP3Start(ToLP3End));
  524. }
  525. private void AlignerToLP4()
  526. {
  527. ToAlignerStart(() => ToLP4Start(ToLP4End));
  528. }
  529. private void LP1ToHome()
  530. {
  531. ToLP1Start(ToHome);
  532. }
  533. private void LP2ToHome()
  534. {
  535. ToLP2Start(ToHome);
  536. }
  537. private void AlignerToHome()
  538. {
  539. ToAlignerStart(ToHome);
  540. }
  541. private void HomeToInvertion()
  542. {
  543. ToInvertionEnd();
  544. }
  545. private void LP1ToInvertion()
  546. {
  547. ToLP1Start(ToInvertionEnd);
  548. }
  549. private void LP2ToInvertion()
  550. {
  551. ToLP2Start(ToInvertionEnd);
  552. }
  553. private void LP3ToInvertion()
  554. {
  555. ToLP3Start(ToInvertionEnd);
  556. }
  557. private void LP4ToInvertion()
  558. {
  559. ToLP4Start(ToInvertionEnd);
  560. }
  561. private void AlignerToInvertion()
  562. {
  563. ToAlignerStart(ToInvertionEnd);
  564. }
  565. private void ToLP1Start(Action action = null)
  566. {
  567. canvas1.Rotate(80, true, ms, 0, 0, () => { if (action != null) action(); });
  568. canvas2.Rotate(280, true, ms, 0.5);
  569. if (Blade1Status == BladeStatus4LP.Extend) canvas3.Rotate(270, true, ms);
  570. if (Blade2Status == BladeStatus4LP.Extend) canvas23.Rotate(270, true, ms);
  571. CurrentPosition = RobotPostion4LP.LP1;
  572. }
  573. private void ToLP2Start(Action action = null)
  574. {
  575. canvas1.Rotate(120, true, ms, 0, 0, () => { if (action != null) action(); });
  576. canvas2.Rotate(260, true, ms, 0.5);
  577. if (Blade1Status == BladeStatus4LP.Extend) canvas3.Rotate(250, true, ms);
  578. if (Blade2Status == BladeStatus4LP.Extend) canvas23.Rotate(250, true, ms);
  579. CurrentPosition = RobotPostion4LP.LP2;
  580. }
  581. private void ToLP3Start(Action action = null)
  582. {
  583. canvas1.Rotate(50, true, ms, 0, 0, () => { if (action != null) action(); });
  584. canvas2.Rotate(130, true, ms, 0.5);
  585. if (Blade1Status == BladeStatus4LP.Extend) canvas3.Rotate(90, true, ms);
  586. if (Blade2Status == BladeStatus4LP.Extend) canvas23.Rotate(90, true, ms);
  587. CurrentPosition = RobotPostion4LP.LP3;
  588. }
  589. private void ToLP4Start(Action action = null)
  590. {
  591. canvas1.Rotate(120, true, ms, 0, 0, () => { if (action != null) action(); });
  592. canvas2.Rotate(60, true, ms, 0.5);
  593. if (Blade1Status == BladeStatus4LP.Extend) canvas3.Rotate(90, true, ms);
  594. if (Blade2Status == BladeStatus4LP.Extend) canvas23.Rotate(90, true, ms);
  595. CurrentPosition = RobotPostion4LP.LP4;
  596. }
  597. private void ToAlignerStart(Action action = null)
  598. {
  599. canvas1.Rotate(45, true, ms, 0, 0, () => { if (action != null) action(); });
  600. canvas2.Rotate(135, true, ms, 0);
  601. if (Blade1Status == BladeStatus4LP.Extend)
  602. canvas3.Rotate(0, true, ms);
  603. if (Blade2Status == BladeStatus4LP.Extend)
  604. canvas23.Rotate(0, true, ms);
  605. CurrentPosition = RobotPostion4LP.Aligner;
  606. }
  607. private void ToLP1End()
  608. {
  609. canvas1.Rotate(40, true, ms, 0);
  610. canvas2.Rotate(290, true, ms, 0);
  611. if (Blade1Status == BladeStatus4LP.Extend) canvas3.Rotate(300, true, ms, 0);
  612. if (Blade2Status == BladeStatus4LP.Extend) canvas23.Rotate(300, true, ms, 0);
  613. CurrentPosition = RobotPostion4LP.LP1;
  614. }
  615. private void ToLP2End()
  616. {
  617. canvas1.Rotate(70, true, ms, 0);
  618. canvas2.Rotate(210, true, ms, 0);
  619. if (Blade1Status == BladeStatus4LP.Extend) canvas3.Rotate(350, true, ms, 0);
  620. if (Blade2Status == BladeStatus4LP.Extend) canvas23.Rotate(350, true, ms, 0);
  621. CurrentPosition = RobotPostion4LP.LP2;
  622. }
  623. private void ToLP3End()
  624. {
  625. canvas1.Rotate(100, true, ms, 0);
  626. canvas2.Rotate(150, true, ms, 0);
  627. if (Blade1Status == BladeStatus4LP.Extend) canvas3.Rotate(20, true, ms, 0);
  628. if (Blade2Status == BladeStatus4LP.Extend) canvas23.Rotate(20, true, ms, 0);
  629. CurrentPosition = RobotPostion4LP.LP3;
  630. }
  631. private void ToLP4End()
  632. {
  633. canvas1.Rotate(145, true, ms, 0);
  634. canvas2.Rotate(75, true, ms, 0);
  635. if (Blade1Status == BladeStatus4LP.Extend) canvas3.Rotate(50, true, ms, 0);
  636. if (Blade2Status == BladeStatus4LP.Extend) canvas23.Rotate(50, true, ms, 0);
  637. CurrentPosition = RobotPostion4LP.LP4;
  638. }
  639. private void ToAlignerEnd()
  640. {
  641. canvas1.Rotate(150, true, ms, 0);
  642. canvas2.Rotate(30, true, ms, 0);
  643. if (Blade1Status == BladeStatus4LP.Extend) canvas3.Rotate(0, true, ms, 0);
  644. if (Blade2Status == BladeStatus4LP.Extend) canvas23.Rotate(0, true, ms, 0);
  645. CurrentPosition = RobotPostion4LP.Aligner;
  646. }
  647. private void ToHome()
  648. {
  649. canvas1.Rotate(90, true, ms);
  650. canvas2.Rotate(180, true, ms);
  651. if (Blade1Status == BladeStatus4LP.Extend) canvas3.Rotate(180, true, ms);
  652. if (Blade2Status == BladeStatus4LP.Extend) canvas23.Rotate(180, true, ms);
  653. CurrentPosition = RobotPostion4LP.Home;
  654. }
  655. private void ToInvertionEnd()
  656. {
  657. canvas1.Rotate(30, true, ms);
  658. canvas2.Rotate(120, true, ms);
  659. if (Blade1Status == BladeStatus4LP.Extend) canvas3.Rotate(300, true, ms);
  660. if (Blade2Status == BladeStatus4LP.Extend) canvas23.Rotate(300, true, ms);
  661. CurrentPosition = RobotPostion4LP.Invertion;
  662. }
  663. private void mnuToLP1_Click(object sender, RoutedEventArgs e)
  664. {
  665. MoveToLP1();
  666. }
  667. private void mnuToLP2_Click(object sender, RoutedEventArgs e)
  668. {
  669. MoveToLP2();
  670. }
  671. private void mnuToHome_Click(object sender, RoutedEventArgs e)
  672. {
  673. MoveToHome();
  674. }
  675. private void mnuToAligner_Click(object sender, RoutedEventArgs e)
  676. {
  677. MoveToAligner();
  678. }
  679. private void mnuToInvertion_Click(object sender, RoutedEventArgs e)
  680. {
  681. MoveToInvertion();
  682. }
  683. private void mnuToLP3_Click(object sender, RoutedEventArgs e)
  684. {
  685. MoveToLP3();
  686. }
  687. private void mnuToLP4_Click(object sender, RoutedEventArgs e)
  688. {
  689. MoveToLP4();
  690. }
  691. }
  692. public enum RobotPostion4LP
  693. {
  694. Home,
  695. LP1,
  696. LP2,
  697. LP3,
  698. LP4,
  699. Aligner,
  700. Invertion
  701. }
  702. public enum BladeStatus4LP
  703. {
  704. Extend,
  705. Retract
  706. }
  707. }