InvokeServiceClient.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using Aitex.Core.RT.Log;
  2. using Aitex.Core.Util;
  3. using Aitex.Core.WCF;
  4. namespace MECF.Framework.Common.OperationCenter
  5. {
  6. public class InvokeClient : Singleton<InvokeClient>
  7. {
  8. public bool InProcess { get; set; }
  9. private IInvokeService _service;
  10. public IInvokeService Service
  11. {
  12. get
  13. {
  14. if (_service == null)
  15. {
  16. if (InProcess)
  17. {
  18. _service = new InvokeService();
  19. }
  20. else
  21. {
  22. _service = new InvokeServiceClient();
  23. }
  24. }
  25. return _service;
  26. }
  27. }
  28. }
  29. public class InvokeServiceClient : ServiceClientWrapper<IInvokeService>, IInvokeService
  30. {
  31. public InvokeServiceClient()
  32. : base("Client_IInvokeService", "InvokeService")
  33. {
  34. }
  35. public void DoOperation(string operationName, params object[] args)
  36. {
  37. string argsList = "";
  38. if (args.Length > 0)
  39. {
  40. foreach (object arg in args)
  41. {
  42. argsList += (" " + arg.ToString());
  43. }
  44. }
  45. LOG.WriteLog(eEvent.EV_DEVICE_INFO, "", $"{operationName} was execute,parameter :{string.Join(" ", args)}");
  46. Invoke(svc => { svc.DoOperation(operationName, args); });
  47. }
  48. }
  49. }