Example #1
0
        public MainForm()
        {
            InitializeComponent();

            mBtAdt = new BluetoothAdapter();

            mPenCommV1 = new PenCommV1(this);
            mPenCommV2 = new PenCommV2(this);

            mWidth  = pictureBox1.Width;
            mHeight = pictureBox1.Height;

            mBitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height);

            mPwdForm = new PasswordInputForm(OnInputPassword);
        }
        public Form1()
        {
            InitializeComponent();
            mBtAdt = new BluetoothAdapter();

            mPenCommV1 = new PenCommV1(this);
            mPenCommV2 = new PenCommV2(this);

            mWidth  = pictureBox1.Width;
            mHeight = pictureBox1.Height;

            mBitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height);

            mColor = Color.Blue;

            //Set the background to white.
            Graphics g = Graphics.FromImage(mBitmap);

            g.Clear(Color.White);
            g.Dispose();

            //add items to both the combobox
            loadcbNb();
            loadcbCol();

            //Set background color for labels
            label1_blue.BackColor   = Color.Blue;
            label1_blue.ForeColor   = Color.Blue;
            label1_blue.BorderStyle = BorderStyle.FixedSingle;

            label2_green.BackColor = Color.Green;
            label2_green.ForeColor = Color.Green;

            label3_black.BackColor = Color.Black;
            label3_black.ForeColor = Color.Black;

            label4_purple.BackColor = Color.Purple;
            label4_purple.ForeColor = Color.Purple;

            label5_brown.BackColor = Color.Brown;
            label5_brown.ForeColor = Color.Brown;

            label6_red.BackColor = Color.Red;
            label6_red.ForeColor = Color.Red;
        }
Example #3
0
        /// <summary>
        /// Attempt to connect to a pen device.
        /// This method will block until a connection is made or the connection fails.
        /// If you do not want block UI thread, you have to invoke method in another thread.
        /// </summary>
        /// <param name="btAddr">MAC address of pen</param>
        /// <returns>true if connection is made, otherwise false.</returns>
        public bool Connect(string btAddr)
        {
            return(mBtAdapter.Connect(btAddr, delegate(uint deviceClass)
            {
                mCommV1 = new PenCommV1(mCallbackV1);
                mCommV2 = new PenCommV2(mCallbackV2);

                if (deviceClass == 0x0500)
                {
                    IsV1Comm = true;
                    System.Console.WriteLine("bind socket with v1 {0}", deviceClass);
                    mBtAdapter.Bind(mCommV1);
                }
                else if (deviceClass == 0x2510)
                {
                    IsV1Comm = false;
                    System.Console.WriteLine("bind socket with v2 {0}", deviceClass);
                    mBtAdapter.Bind(mCommV2);
                }
            }));
        }
Example #4
0
        public MainForm()
        {
            InitializeComponent();
            mBtAdt = new BluetoothAdapter();

            // Create MetadataManager
            mMetadataManager = new GenericMetadataManager(new NProjParser());

            mPenCommV1 = new PenCommV1(this);
            mPenCommV2 = new PenCommV2(this);

            // Bind MetadataManager to PenComm.
            mPenCommV1.MetadataManager = mMetadataManager;
            mPenCommV2.MetadataManager = mMetadataManager;

            mWidth  = pictureBox1.Width;
            mHeight = pictureBox1.Height;

            mBitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height);

            mPwdForm = new PasswordInputForm(OnInputPassword);
        }
Example #5
0
 public void SetUp()
 {
     _btAdt   = new BluetoothAdapter();
     _penComm = new PenCommV2(this);
 }