コード例 #1
0
 public void HandleInputEvent(object sender, NSStreamEventArgs e)
 {
     Console.WriteLine("***** Input ***** " + e.StreamEvent);
     if (e.StreamEvent == NSStreamEvent.HasBytesAvailable)
     {
         var  buffer     = new byte[1024];
         nint bytesRead  = inputStream.Read(buffer, 3);
         var  stringRead = Encoding.UTF8.GetString(buffer);
         Console.WriteLine("***** String ***** " + stringRead);
     }
 }
コード例 #2
0
        private void InputStream_OnEvent(object sender, NSStreamEventArgs e)
        {
            Console.WriteLine($"InputStream:{e.StreamEvent}");

            // something was scanned
            if (e.StreamEvent == NSStreamEvent.HasBytesAvailable)
            {
                if (!(sender is NSInputStream input))
                {
                    return;
                }
                byte[] buffer    = new byte[1024];
                var    bytesRead = input.Read(buffer, 1024);

                var dataString = GetDataString(buffer, bytesRead);
                Console.WriteLine($"BytesRead:{bytesRead}");
                Console.WriteLine($"Barcode:{dataString}");

                Xamarin.Forms.MessagingCenter.Send <App, string>((App)Xamarin.Forms.Application.Current, "Barcode", dataString);
            }
        }
コード例 #3
0
 public void HandleOutputEvent(object sender, NSStreamEventArgs e)
 {
     Console.WriteLine("***** Output ***** " + e.StreamEvent);
 }
コード例 #4
0
 void Ignored(object sender, NSStreamEventArgs e)
 {
     //throw new NotImplementedException ();
 }
コード例 #5
0
 void DataReceived(object sender, NSStreamEventArgs e)
 {
     // TODO - ignored for now...
     // throw new NotImplementedException ();
 }
コード例 #6
0
		void Ignored (object sender, NSStreamEventArgs e)
		{
			//throw new NotImplementedException ();
		}
コード例 #7
0
		void DataReceived (object sender, NSStreamEventArgs e)
		{
			// TODO - ignored for now...
			// throw new NotImplementedException ();
		}