Ejemplo n.º 1
0
        public BluetoothConnect(ref Comm.BT.BTPort btport)
        {
            PriceMarkdown.ResClass2 _resClass = PriceMarkdown.ResClass2.getInstance();
            _resClass.colorizeForm(this);

            _btport = btport;
            InitializeComponent();
#if DEBUG
            txtBTAddress.Text = "000666025f1d";
#endif
        }
Ejemplo n.º 2
0
        public ConnectDlg(ref SerialPort sp)
        {
            InitializeComponent();

            PriceMarkdown.ResClass2 _resClass = PriceMarkdown.ResClass2.getInstance();
            _resClass.colorizeForm(this);

            if (System.IO.File.Exists("\\windows\\ibt.dll"))
            {
                btnBTPrinter.Enabled = true;
            }
            else
            {
                btnBTPrinter.Enabled = false;
            }

            //port list
            cmbPortName.Items.Clear();
            for (int i = 0; i < 10; i++)
            {
                cmbPortName.Items.Insert(i, "COM" + i.ToString());
            }
            int ix = cmbPortName.Items.IndexOf(_mySettings.sPort);

            if (ix != -1)
            {
                cmbPortName.SelectedIndex = ix;
            }
            else
            {
                cmbPortName.SelectedIndex = 0;
            }

            //baud list
            cmbBaudRate.Items.Clear();
            int j = 0;

            foreach (uint u in _mySettings.baudRates)
            {
                cmbBaudRate.Items.Insert(j, u.ToString());
                j++;
            }
            ix = findInCombo(cmbBaudRate, _mySettings.baudRate.ToString());
            if (ix != -1)
            {
                cmbBaudRate.SelectedIndex = ix;
            }
            else
            {
                cmbBaudRate.SelectedIndex = 0;
            }

            //databits
            cmbDataBits.Items.Clear();
            for (int i = 6; i < 9; i++)
            {
                cmbDataBits.Items.Add(i.ToString());
            }
            ix = findInCombo(cmbDataBits, _mySettings.databits.ToString());
            if (ix != -1)
            {
                cmbDataBits.SelectedIndex = ix;
            }
            else
            {
                cmbDataBits.SelectedIndex = 0;
            }

            //parity
            cmbParity.Items.Clear();
            for (int i = 0; i < myParity.parity.Length; i++)
            {
                cmbParity.Items.Insert(i, myParity.ToString(i));
            }

            cmbParity.SelectedIndex = (int)_mySettings.parity;

            //stopBits
            cmbStopBits.Items.Clear();
            for (int i = 0; i < 3; i++)
            {
                cmbStopBits.Items.Insert(i, myStopBits.ToString(i));
            }
            ix = findInCombo(cmbStopBits, _mySettings.stopBits.ToString());
            if (ix != -1)
            {
                cmbStopBits.SelectedIndex = ix;
            }
            else
            {
                cmbStopBits.SelectedIndex = 1;
            }
//            cmbStopBits.SelectedIndex = cmbStopBits.Items.IndexOf(_mySettings.stopBits);

            //handshake
            cmbHandshake.Items.Clear();
            for (int i = 0; i < myHandshake.handshakes.Length; i++)
            {
                cmbHandshake.Items.Insert(i, myHandshake.ToString(i));
            }
            cmbHandshake.SelectedIndex = (int)_mySettings.handshake;

            this._serialPort = sp;
        }