form1

Download Form1

If you can't read please download the document

Upload: mauro-ferreira-de-lima

Post on 18-Dec-2015

212 views

Category:

Documents


0 download

DESCRIPTION

form 1

TRANSCRIPT

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO;using System.Drawing.Drawing2D;namespace AppUSB_HID{ public partial class Form1 : Form { string bfRecebe = string.Empty; //Criando o mtodo(funo) Fdelegate que vai receber o parmetro do tipo string 'a' public delegate void Fdelegate(string a); float eixo_x = 0, eixo_y = 0; List TempList = new List(); string txtList = string.Empty; int qtde_data = 0; //Vetor de 32 bytes para envio do comando USB byte[] BufferOut = new byte[32]; //Varivel para limpeza dos bytes que no sero utilizados no envio USB byte clr_buffer; public Form1() { InitializeComponent(); USBCom.OnDataRecieved += new UsbLibrary.DataRecievedEventHandler(USBCom_OnDataRecieved); } void USBCom_OnDataRecieved(object sender, UsbLibrary.DataRecievedEventArgs args) { //throw new NotImplementedException(); string bfRecebe = "Dados: "; foreach (byte mydata in args.data) { if (mydata.ToString().Length == 1) bfRecebe += "00"; if (mydata.ToString().Length == 2) bfRecebe += "0"; bfRecebe += mydata.ToString() + " "; } this.BeginInvoke(new Fdelegate(recebe_usb), new object[] { bfRecebe }); } public void recebe_usb(string a) { string[] txtSplit; int adc1, adc3, v1, v3; label1.Text = a; txtSplit = a.Split(' '); adc1 = (int)Convert.ToInt32(txtSplit[2])