示例#1
0
            public override void handleMessage(Message msg)
            {
                switch (msg.what)
                {
                case BixolonLabelPrinter.MESSAGE_STATE_CHANGE:
                    switch (msg.arg1)
                    {
                    case BixolonLabelPrinter.STATE_CONNECTED:
                        outerInstance.Status            = getString([email protected]_connected_to, outerInstance.mConnectedDeviceName);
                        outerInstance.mListView.Enabled = true;
                        outerInstance.mIsConnected      = true;
                        invalidateOptionsMenu();
                        break;

                    case BixolonLabelPrinter.STATE_CONNECTING:
                        outerInstance.Status = [email protected]_connecting;
                        break;

                    case BixolonLabelPrinter.STATE_NONE:
                        outerInstance.Status            = [email protected]_not_connected;
                        outerInstance.mListView.Enabled = false;
                        outerInstance.mIsConnected      = false;
                        invalidateOptionsMenu();
                        break;
                    }
                    break;

                case BixolonLabelPrinter.MESSAGE_READ:
                    outerInstance.dispatchMessage(msg);
                    break;

                case BixolonLabelPrinter.MESSAGE_DEVICE_NAME:
                    outerInstance.mConnectedDeviceName = msg.Data.getString(BixolonLabelPrinter.DEVICE_NAME);
                    Toast.makeText(ApplicationContext, outerInstance.mConnectedDeviceName, Toast.LENGTH_LONG).show();
                    break;

                case BixolonLabelPrinter.MESSAGE_TOAST:
                    outerInstance.mListView.Enabled = false;
                    Toast.makeText(ApplicationContext, msg.Data.getString(BixolonLabelPrinter.TOAST), Toast.LENGTH_SHORT).show();
                    break;

                case BixolonLabelPrinter.MESSAGE_BLUETOOTH_DEVICE_SET:
                    if (msg.obj == null)
                    {
                        Toast.makeText(ApplicationContext, "No paired device", Toast.LENGTH_SHORT).show();
                    }
                    else
                    {
                        DialogManager.showBluetoothDialog(outerInstance, (ISet <BluetoothDevice>)msg.obj);
                    }
                    break;

                case BixolonLabelPrinter.MESSAGE_USB_DEVICE_SET:
                    if (msg.obj == null)
                    {
                        Toast.makeText(ApplicationContext, "No connected device", Toast.LENGTH_SHORT).show();
                    }
                    else
                    {
                        DialogManager.showUsbDialog(outerInstance, (ISet <UsbDevice>)msg.obj, mUsbReceiver);
                    }
                    break;

                case BixolonLabelPrinter.MESSAGE_NETWORK_DEVICE_SET:
                    if (msg.obj == null)
                    {
                        Toast.makeText(ApplicationContext, "No connectable device", Toast.LENGTH_SHORT).show();
                    }
                    DialogManager.showNetworkDialog(outerInstance, (ISet <string>)msg.obj);
                    break;
                }
            }
示例#2
0
        protected internal override void onListItemClick(ListView l, View v, int position, long id)
        {
            switch (position)
            {
            case 0:             // drawText
                Intent intent = new Intent(MainActivity.this, typeof(DrawTextActivity));
                startActivity(intent);
                break;

            case 1:             // drawVectorFontText
                intent = new Intent(MainActivity.this, typeof(DrawVectorTextActivity));
                startActivity(intent);
                break;

            case 2:             // draw1dBarcode
                intent = new Intent(MainActivity.this, typeof(Draw1dBarcodeActivity));
                startActivity(intent);
                break;

            case 3:             // drawMaxicode
                intent = new Intent(MainActivity.this, typeof(DrawMaxicodeActivity));
                startActivity(intent);
                break;

            case 4:             // drawPdf417
                intent = new Intent(MainActivity.this, typeof(DrawPdf417Activity));
                startActivity(intent);
                break;

            case 5:             // drawQrCode
                intent = new Intent(MainActivity.this, typeof(DrawQrCodeActivity));
                startActivity(intent);
                break;

            case 6:             // drawDataMatrix
                intent = new Intent(MainActivity.this, typeof(DrawDataMatrixActivity));
                startActivity(intent);
                break;

            case 7:             // drawBlock
                intent = new Intent(MainActivity.this, typeof(DrawBlockActivity));
                startActivity(intent);
                break;

            case 8:             // drawCircle
                intent = new Intent(MainActivity.this, typeof(DrawCircleActivity));
                startActivity(intent);
                break;

            case 9:             // setCharacterSet
                intent = new Intent(MainActivity.this, typeof(CharacterSetSelectionActivity));
                startActivity(intent);
                break;

            case 10:             // setPrintingType
                DialogManager.showSetPrintingTypeDialog(mSetPrintingTypeDialog, MainActivity.this);
                break;

            case 11:             // setMargin
                DialogManager.showSetMarginDialog(mSetMarginDialog, MainActivity.this);
                break;

            case 12:             // setBackFeedOption
                DialogManager.showSeBackFeedDialog(mSetBackfeedDialog, MainActivity.this);
                break;

            case 13:             // setLength
                DialogManager.showSetLengthDialog(mSetLengthDialog, MainActivity.this);
                break;

            case 14:             // setWidth
                DialogManager.showSetWidthDialog(mSetWidthDialog, MainActivity.this);
                break;

            case 15:             // setBufferMode
                DialogManager.showSetBufferModeDialog(mSetBufferModeDialog, MainActivity.this);
                break;

            case 16:             // clearBuffer
                mBixolonLabelPrinter.clearBuffer();
                break;

            case 17:             // setSpeed
                DialogManager.showSetSpeedDialog(mSetSpeedDialog, MainActivity.this);
                break;

            case 18:             // setDensity
                DialogManager.showSetDensityDialog(mSetDensityDialog, MainActivity.this);
                break;

            case 19:             // setOrientation
                DialogManager.showSetOrientationDialog(mSetOrientationDialog, MainActivity.this);
                break;

            case 20:             // setOffset
                DialogManager.showSetOffsetDialog(mSetOffsetDialog, MainActivity.this);
                break;

            case 21:             // setCutterPosition
                DialogManager.showCutterPositionSettingDialog(mCutterPositionSettingDialog, MainActivity.this);
                break;

            case 22:             // drawBitmap
                intent = new Intent(MainActivity.this, typeof(DrawBitmapActivity));
                startActivity(intent);
                break;

            case 23:             // initializePrinter
                mBixolonLabelPrinter.initializePrinter();
                break;

            case 24:             // printInformation
                mBixolonLabelPrinter.printInformation();
                break;

            case 25:             // setAutoCutter
                DialogManager.showAutoCutterDialog(mAutoCutterDialog, MainActivity.this);
                break;

            case 26:             // getStatus
                mBixolonLabelPrinter.getStatus(true);
                break;

            case 27:             // getPrinterInformation
                DialogManager.showPrinterInformationDialog(mPrinterInformationDialog, MainActivity.this, mBixolonLabelPrinter);
                break;

            case 28:             // executeDirectIo
                intent = new Intent(MainActivity.this, typeof(DirectIoActivity));
                startActivity(intent);
                break;
            }
        }