Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.96 KB | None | 0 0
  1. // When the app goes into the background the DidEnterBackground() function is called and it looks like this:
  2. public override void WillEnterForeground(UIKit.UIApplication application)
  3. {
  4.     SAMISMPManager.SharedManager.BarcodeReader.PowerOn();
  5.     SAMISMPManager.SharedManager.BarcodeReader.EnableTrigger(true);
  6.     SAMISMPManager.SharedManager.BarcodeReader.EnableSymbology(eICBarCodeSymbologies.ICBarCode_QRCodetrue);
  7.     IBarcodeScanner.BarcodeScanned -= IBarcodeScanner_BarcodeScanned;
  8.  
  9. // When the app goes into the foreground the WillEnterForeground() function is called and it looks like this:
  10. public override void DidEnterBackground(UIApplication application)
  11. {
  12.     ExternalAccessoryManagement.sharedManager = SAMISMPManager.SharedManager;
  13.     ExternalAccessoryManagement.sharedManager.Delegate = new MySamIsmpDelegate(this.ConnectionStatusChange);
  14.     ExternalAccessoryManagement.sharedChannel = ICAdministration.SharedChannel as ICAdministration;
  15.     ExternalAccessoryManagement.sharedChannel.Open();
  16.    
  17.     EFT.sharedChannel = ICAdministration.SharedChannel as ICAdministration;
  18.     EFT.sharedChannel.Delegate = new MyICAdministrationStandAloneDelegate();
  19.  
  20.     NSMutableData transaction = new NSMutableData();
  21.     var header = new byte[]{
  22.         0x00, 0x00, 0x00, 0x00,
  23.         0x00, 0x00, 0x00, 0x00,
  24.         };
  25.     transaction.AppendBytes(header);
  26.     var getLastTransactionCommand = BitConverter.GetBytes(2060);
  27.  
  28.     if (BitConverter.IsLittleEndian)
  29.     Array.Reverse(getLastTransactionCommand); //reverse it so we get big endian.
  30.     transaction.AppendBytes(getLastTransactionCommand);
  31.     var dataLength = new byte[]{
  32.         0x00, 0x00, 0x00, 0x00,
  33.     };
  34.     transaction.AppendBytes(dataLength);
  35.      bool result = sharedChannel.SendMessage(transaction);
  36.  
  37.     this.IEFT.OpenConnection();
  38.     this.IBarcodeScanner = new BarcodeScanner(this.IEAManagement);
  39.     this.IBarcodeScanner.OpenScannerConnection();
  40.     IBarcodeScanner.BarcodeScanned += IBarcodeScanner_BarcodeScanned;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement