Esempio n. 1
0
        void testConnect2(BluetoothDevice btdev)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                Application.DoEvents();
                if (button1.Text == "print")
                {
                    btstream = new BluetoothStream(btdev);
                    btstream.recvThreadEvent += new BluetoothStream.recvThreadEventHandler(btstream_recvThreadEvent);
                    int iTry = 3;
                    while (iTry > 0 && btstream._connected == false)
                    {
                        System.Threading.Thread.Sleep(1000);
                        iTry--;
                    }
                    if (btstream._connected)
                    {
                        if (radioFP.Checked)
                        {
                            btstream.write(Intermec.Printer.Language.Fingerprint.Demo.FP_2_WalmartLabel());
                        }
                        else if (radioIPL.Checked)
                        {
                            btstream.write(Intermec.Printer.Language.Fingerprint.Demo.IPL_2_WalmartLabel());
                        }
                        else if (radioESCP.Checked)
                        {
                            btstream.write(Intermec.Printer.Language.Fingerprint.Demo.ESCP_PRODLIST2);
                        }

                        button1.Text = "disconnect";
                    }
                    else
                    {
                        btstream.Dispose();
                    }
                }
                else if (button1.Text == "disconnect")
                {
                    btstream.recvThreadEvent -= btstream_recvThreadEvent;
                    btstream.Dispose();
                    button1.Text = "print";
                }
            }
            catch (Exception ex)
            {
                ddump("testConnect2 Exception " + ex.Message);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
                Application.DoEvents();
            }
        }
Esempio n. 2
0
 private void btnAgain_Click(object sender, EventArgs e)
 {
     if (btstream == null)
     {
         ddump("not connected!");
         return;
     }
     if (btstream._connected)
     {
         ddump("printing again...");
         if (radioIPL.Checked)
         {
             btstream.write(Intermec.Printer.Language.Fingerprint.Demo.IPL_2_WalmartLabel());// FP_2_WalmartLabel());
         }
         else if (radioFP.Checked)
         {
             btstream.write(Intermec.Printer.Language.Fingerprint.Demo.FP_2_WalmartLabel());
         }
     }
     else
     {
         ddump("not connected!");
     }
 }