Exemplo n.º 1
0
        private void Connect_Click(object sender, EventArgs e)
        {
            IntPtr hWnd = this.Handle;

            int bRes = DLLHelper.UsbOpenDevice(hWnd, 0);

            if (bRes == 1)
            {
                textBox1.Text = "Connected!";
            }
            else
            {
                textBox1.Text = "Err:" + bRes.ToString();
            }

            bRes = DLLHelper.ReadFlashData(0);
            if (bRes == 1)
            {
                textBox1.Text = "Flash read completed";
                //need to enable th good buttons
                // btnStream.Enabled = true;
                //btnDisconnect.Enabled = true;
                // btnCalibrate.Enabled = true;
            }
            else
            {
                textBox1.Text = "Err:" + bRes.ToString();
            }
        }
Exemplo n.º 2
0
        private void OnePhoto_Click(object sender, EventArgs e)
        {
            ushort[]     imageData  = new ushort[288 * 384];
            byte[]       bArr       = new byte[288 * 384];
            Bitmap       b          = new Bitmap(384, 288, PixelFormat.Format8bppIndexed);
            ColorPalette ncp        = b.Palette;
            Rectangle    BoundsRect = new Rectangle(0, 0, 384, 288);
            BitmapData   bmpData;
            IntPtr       ptr;

            //put the image in black and white
            for (int i = 0; i < 256; i++)
            {
                ncp.Entries[i] = Color.FromArgb(255, i, i, i);
            }
            b.Palette = ncp;

            DLLHelper.RecvImage(imageData, 0);

            for (int n = 0; n < 288 * 384; n++)
            {
                bArr[n] = (byte)(imageData[n] >> 8);
            }
            bmpData = b.LockBits(BoundsRect, ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);
            ptr     = bmpData.Scan0;

            Marshal.Copy(bArr, 0, ptr, bmpData.Stride * 288);
            b.UnlockBits(bmpData);
            SaveImage(b);
            RefreshImage(b);

            //to do retrive the data from the  CalcEntireTemp fonction
        }
Exemplo n.º 3
0
        private void saveTherm_Click(object sender, EventArgs e)
        {
            ushort[] imageData = new ushort[288 * 384];
            double   lol       = 0;

            lol = DLLHelper.CalcTemp(0, 0, false, 0);

            Console.WriteLine(lol);
        }
Exemplo n.º 4
0
        private void Timer1_Tick(object sender, EventArgs e)
        {
            ushort[]     imageData  = new ushort[288 * 384];
            byte[]       bArr       = new byte[288 * 384];
            Bitmap       b          = new Bitmap(384, 288, PixelFormat.Format8bppIndexed);
            ColorPalette ncp        = b.Palette;
            Rectangle    BoundsRect = new Rectangle(0, 0, 384, 288);
            BitmapData   bmpData;
            IntPtr       ptr;

            for (int i = 0; i < 256; i++)
            {
                ncp.Entries[i] = Color.FromArgb(255, i, i, i);
            }
            b.Palette = ncp;


            DLLHelper.RecvImage(imageData, 0);
            for (int n = 0; n < 288 * 384; n++)
            {
                bArr[n] = (byte)(imageData[n] >> 8);
            }
            bmpData = b.LockBits(BoundsRect, ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);
            ptr     = bmpData.Scan0;

            Marshal.Copy(bArr, 0, ptr, bmpData.Stride * 288);
            b.UnlockBits(bmpData);

            SaveImage(b);
            RefreshImage(b);


            if (textBox1.Text.Equals("tick"))
            {
                textBox1.Text = "tack";
            }
            else
            {
                textBox1.Text = "tick";
            }
        }
Exemplo n.º 5
0
 private void Disconnect_Click(object sender, EventArgs e)
 {
     DLLHelper.UsbCloseDevice(0);
     textBox1.Text = "Disconnected!";
 }