RfidReaderControl.xaml.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System.Collections.Generic;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using System.Windows.Input;
  5. using Aitex.Core.UI.MVVM;
  6. using Aitex.Sorter.Common;
  7. using Aitex.Sorter.UI.Controls.Common;
  8. using MECF.Framework.Common.OperationCenter;
  9. namespace Aitex.Sorter.UI.Controls
  10. {
  11. public partial class RfidReaderControl : UserControl
  12. {
  13. public static readonly DependencyProperty RfidStatusProperty = DependencyProperty.Register(
  14. "RfidStatus", typeof(string), typeof(RfidReaderControl), new PropertyMetadata(default(string)));
  15. public string RfidStatus
  16. {
  17. get { return (string) GetValue(RfidStatusProperty); }
  18. set { SetValue(RfidStatusProperty, value); }
  19. }
  20. public static readonly DependencyProperty StationProperty = DependencyProperty.Register(
  21. "Station", typeof(string), typeof(RfidReaderControl), new PropertyMetadata(default(string)));
  22. public string Station
  23. {
  24. get { return (string) GetValue(StationProperty); }
  25. set { SetValue(StationProperty, value); }
  26. }
  27. public static readonly DependencyProperty IDProperty = DependencyProperty.Register(
  28. "ID", typeof(string), typeof(RfidReaderControl), new PropertyMetadata(default(string)));
  29. public string ID
  30. {
  31. get { return (string) GetValue(IDProperty); }
  32. set { SetValue(IDProperty, value); }
  33. }
  34. public ICommand RFReaderCommand
  35. {
  36. get;
  37. private set;
  38. }
  39. void RFReaderOperation(DependencyObject sender)
  40. {
  41. var command = CommandHelper.GetCommandItem(sender);
  42. var lstParameter = new List<object>
  43. {
  44. Station
  45. };
  46. lstParameter.AddRange(command.Parameters);
  47. InvokeClient.Instance.Service.DoOperation(command.CommandName, lstParameter.ToArray());
  48. }
  49. public RfidReaderControl()
  50. {
  51. InitializeComponent();
  52. RFReaderCommand = new DelegateCommand<DependencyObject>(RFReaderOperation);
  53. root.DataContext = this;
  54. }
  55. }
  56. }