ClientApp.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.ServiceModel;
  7. using System.IO;
  8. using System.Reflection;
  9. using System.ServiceProcess;
  10. using Aitex.Core.RT.Log;
  11. using Caliburn.Micro;
  12. using OpenSEMI.ClientBase;
  13. using OpenSEMI.ClientBase.UI;
  14. using OpenSEMI.ClientBase.Handlers;
  15. using VirgoUI.Client.Models.Sys;
  16. using MECF.Framework.Common.DataCenter;
  17. namespace VirgoUI.Client
  18. {
  19. public class ClientApp : OpenSEMI.ClientBase.BaseApp
  20. {
  21. public ClientApp()
  22. {
  23. }
  24. protected override void OnInitialize()
  25. {
  26. try
  27. {
  28. //States looper to update UI
  29. this.stateImp = new StatesImp(QueryDataClient.Instance.Service);
  30. this.StatesManager = new StatesHandler(this.stateImp.GetStates, this.stateImp.Keys);
  31. this.StatesManager.Handle();
  32. //wafer status looper
  33. this.waferStatusImp = new WaferStatusImp(QueryDataClient.Instance.Service);
  34. this.WaferStatusManager = new WaferStatusHandler(this.waferStatusImp.GetWaferStatus, ModuleManager.ModulesID);
  35. this.WaferStatusManager.Handle();
  36. ModuleManager.Initialize();
  37. //need get the view in OpenSEMI.ClientBase by Calibrun (Dialog view and so on)
  38. var file = string.Format("{0}OpenSEMI.ClientBase.dll", System.AppDomain.CurrentDomain.BaseDirectory);
  39. if (File.Exists(file))
  40. {
  41. Assembly assembly = Assembly.LoadFile(file);
  42. AssemblySource.Instance.Add(assembly);
  43. }
  44. }
  45. catch (Exception ex)
  46. {
  47. LOG.Error(ex.StackTrace);
  48. }
  49. }
  50. public override void Dispose()
  51. {
  52. base.Dispose();
  53. this.WaferStatusManager.looper.Terminate();
  54. this.StatesManager.looper.Terminate();
  55. }
  56. public MainViewModel ViewModelSwitcher { get; set; }
  57. private StatesImp stateImp;
  58. private WaferStatusImp waferStatusImp;
  59. public override void SwitchPage(string mainMenu, string subMenu, object parameter)
  60. {
  61. ViewModelSwitcher.SwitchPage(mainMenu, subMenu, parameter);
  62. }
  63. }
  64. }