示例#1
0
        private void printBitmap()
        {
            string fileName = bitmapPathTextView.Text.ToString();

            try
            {
                int width     = Convert.ToInt32(widthEditText.Text.ToString());
                int alignment = Alignment;

                ByteBuffer buffer = ByteBuffer.allocate(4);
                buffer.put((sbyte)POSPrinterConst.PTR_S_RECEIPT);
                buffer.put((sbyte)brightnessSeekBar.Progress);
                buffer.put((sbyte)0x00);
                buffer.put((sbyte)0x00);

                posPrinter.printBitmap(buffer.getInt(0), fileName, width, alignment);
            }
//JAVA TO C# CONVERTER TODO TASK: There is no equivalent in C# to Java 'multi-catch' syntax:
            catch (NumberFormatException | JposException e)
            {
                e.printStackTrace();
                MessageDialogFragment.showDialog(FragmentManager, "Exception", e.Message);
                return;
            }
        }
        public override void onClick(View v)
        {
            switch (v.Id)
            {
            case R.id.buttonDirectIO:
                int selectedItemPosition = dataSpinner.SelectedItemPosition;

                try
                {
                    posPrinter.directIO(1, null, DATA[selectedItemPosition]);
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Exception", e.Message);
                }
                break;

            case R.id.buttonBatteryStatus:
                try
                {
                    posPrinter.directIO(2, null, null);
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Exception", e.Message);
                }
                break;
            }
        }
示例#3
0
        private void sendPageModeCommand()
        {
            try
            {
                switch (pageModeCommandSpinner.SelectedItemPosition)
                {
                case 0:
                    posPrinter.pageModePrint(POSPrinterConst.PTR_PM_PAGE_MODE);
                    break;

                case 1:
                    posPrinter.pageModePrint(POSPrinterConst.PTR_PM_NORMAL);
                    break;

                case 2:
                    posPrinter.pageModePrint(POSPrinterConst.PTR_PM_CANCEL);
                    break;
                }
            }
            catch (JposException e)
            {
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
                MessageDialogFragment.showDialog(FragmentManager, "Exception", e.Message);
            }
        }
示例#4
0
        private void updateProperties()
        {
            try
            {
                pageModeAreaTextView.Text = posPrinter.PageModeArea;

                string area = pageModePrintAreaEditText1.Text.ToString() + "," + pageModePrintAreaEditText2.Text.ToString() + "," + pageModePrintAreaEditText3.Text.ToString() + "," + pageModePrintAreaEditText4.Text.ToString();
                posPrinter.PageModePrintArea = area;

                int direction = PageModePrintDirection;
                posPrinter.PageModePrintDirection = direction;

                int position = Convert.ToInt32(pageModeHorizontalPositionEditText.Text.ToString());
                posPrinter.PageModeHorizontalPosition = position;

                position = Convert.ToInt32(pageModeVerticalPositionEditText.Text.ToString());
                posPrinter.PageModeVerticalPosition = position;
            }
            catch (JposException e)
            {
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
                MessageDialogFragment.showDialog(FragmentManager, "Exception", e.Message);
            }
        }
示例#5
0
        public override void onCheckedChanged(RadioGroup group, int checkedId)
        {
            switch (checkedId)
            {
            case R.id.radioNotEnabled:
                try
                {
                    msr.DataEncryptionAlgorithm = MSRConst.MSR_DE_NONE;
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;

            case R.id.radioTripleDES:
                try
                {
                    msr.DataEncryptionAlgorithm = MSRConst.MSR_DE_3DEA_DUKPT;
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;
            }
        }
示例#6
0
        public override void onCheckedChanged(RadioGroup group, int checkedId)
        {
            try
            {
                switch (checkedId)
                {
                case R.id.radioSmartCard:
                    smartCardRW.SCSlot = 0x01 << (sizeof(int) - 1);
                    break;

                case R.id.radioSam1:
                    smartCardRW.SCSlot = 0x01 << (sizeof(int) - 2);
                    break;

                case R.id.radioSam2:
                    smartCardRW.SCSlot = 0x01 << (sizeof(int) - 3);
                    break;

                case R.id.radioApdu:
                    smartCardRW.IsoEmvMode = SmartCardRWConst.SC_CMODE_EMV;
                    break;

                case R.id.radioTpdu:
                    smartCardRW.IsoEmvMode = SmartCardRWConst.SC_CMODE_ISO;
                    break;
                }
            }
            catch (JposException e)
            {
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
                MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
            }
        }
		internal static void showDialog(FragmentManager manager, string title, string message)
		{
			MessageDialogFragment messageDialogFragment = new MessageDialogFragment();
			Bundle args = new Bundle();
			args.putString(KEY_TITLE, title);
			args.putString(KEY_MESSAGE, message);
			messageDialogFragment.Arguments = args;
			messageDialogFragment.show(manager, TAG);
		}
        public override void onClick(View v)
        {
            switch (v.Id)
            {
            case R.id.buttonAddEscapeSequence:
                ListDialogFragment.showDialog(FragmentManager, "Escape sequences", ESCAPE_SEQUENCES);
                break;

            case R.id.buttonPrintNormal:
                try
                {
                    posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, sendToPrinterEditText.Text.ToString());
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;

            case R.id.buttonCutPaper:
                try
                {
                    posPrinter.cutPaper(90);
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;

            case R.id.buttonCharacterSet:
                try
                {
                    string        characterSetList = posPrinter.CharacterSetList;
                    List <string> arrayList        = new List <string>();
                    foreach (string token in characterSetList.Split(",", true))
                    {
                        arrayList.Add(token);
                    }
                    string[] items = arrayList.ToArray();
                    ListDialogFragment.showDialog(FragmentManager, getString([email protected]_set), items);
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }

                break;
            }
        }
示例#9
0
        internal static void showDialog(FragmentManager manager, string title, string message)
        {
            MessageDialogFragment messageDialogFragment = new MessageDialogFragment();
            Bundle args = new Bundle();

            args.putString(KEY_TITLE, title);
            args.putString(KEY_MESSAGE, message);
            messageDialogFragment.Arguments = args;
            messageDialogFragment.show(manager, TAG);
        }
示例#10
0
 private void clearPrintArea()
 {
     try
     {
         posPrinter.clearPrintArea();
     }
     catch (JposException e)
     {
         Console.WriteLine(e.ToString());
         Console.Write(e.StackTrace);
         MessageDialogFragment.showDialog(FragmentManager, "Exception", e.Message);
     }
 }
        public override void onCheckedChanged(CompoundButton buttonView, bool isChecked)
        {
            switch (buttonView.Id)
            {
            case R.id.checkBoxDeviceEnabled:
                try
                {
                    posPrinter.DeviceEnabled = isChecked;
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    try
                    {
                        posPrinter.DeviceEnabled = !isChecked;
                    }
                    catch (JposException e1)
                    {
                        // TODO Auto-generated catch block
                        Console.WriteLine(e1.ToString());
                        Console.Write(e1.StackTrace);
                    }
                    MessageDialogFragment.showDialog(FragmentManager, "Exception", e.Message);
                }
                break;

            case R.id.checkBoxAsyncMode:
                try
                {
                    posPrinter.AsyncMode = isChecked;
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    try
                    {
                        posPrinter.AsyncMode = !isChecked;
                    }
                    catch (JposException e1)
                    {
                        // TODO Auto-generated catch block
                        Console.WriteLine(e1.ToString());
                        Console.Write(e1.StackTrace);
                    }
                    MessageDialogFragment.showDialog(FragmentManager, "Exception", e.Message);
                }
                break;
            }
        }
示例#12
0
 private void info()
 {
     try
     {
         string message = "deviceServiceDescription: " + smartCardRW.DeviceServiceDescription + "\ndeviceServiceVersion: " + smartCardRW.DeviceServiceVersion + "\nphysicalDeviceDescription: " + smartCardRW.PhysicalDeviceDescription + "\nphysicalDeviceName: " + smartCardRW.PhysicalDeviceName + "\npowerState: " + smartCardRW.PowerState + "\ninterfaceMode: " + smartCardRW.InterfaceMode + "\nisoEmvMode: " + smartCardRW.IsoEmvMode + "\ntransactionInProgress: " + smartCardRW.TransactionInProgress + "\ntransmissionProtocol: " + smartCardRW.TransmissionProtocol;
         MessageDialogFragment.showDialog(FragmentManager, "Info", message);
     }
     catch (JposException e)
     {
         Console.WriteLine(e.ToString());
         Console.Write(e.StackTrace);
         MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
     }
 }
示例#13
0
 private void checkHealth()
 {
     try
     {
         cashDrawer.checkHealth(JposConst.JPOS_CH_INTERNAL);
         MessageDialogFragment.showDialog(FragmentManager, "checkHealth", cashDrawer.CheckHealthText);
     }
     catch (JposException e)
     {
         Console.WriteLine(e.ToString());
         Console.Write(e.StackTrace);
         MessageDialogFragment.showDialog(FragmentManager, "Exception", e.Message);
     }
 }
        private void info()
        {
            string message;

            try
            {
                message = "deviceServiceDescription: " + posPrinter.DeviceServiceDescription + "\ndeviceServiceVersion: " + posPrinter.DeviceServiceVersion + "\nphysicalDeviceDescription: " + posPrinter.PhysicalDeviceDescription + "\nphysicalDeviceName: " + posPrinter.PhysicalDeviceName + "\npowerState: " + MainActivity.getPowerStateString(posPrinter.PowerState) + "\ncapRecNearEndSensor: " + posPrinter.CapRecNearEndSensor + "\nRecPapercut: " + posPrinter.CapRecPapercut + "\ncapRecMarkFeed: " + getMarkFeedString(posPrinter.CapRecMarkFeed) + "\ncharacterSet: " + posPrinter.CharacterSet + "\ncharacterSetList: " + posPrinter.CharacterSetList + "\nfontTypefaceList: " + posPrinter.FontTypefaceList + "\nrecLineChars: " + posPrinter.RecLineChars + "\nrecLineCharsList: " + posPrinter.RecLineCharsList + "\nrecLineSpacing: " + posPrinter.RecLineSpacing + "\nrecLineWidth: " + posPrinter.RecLineWidth;
                MessageDialogFragment.showDialog(FragmentManager, "Info", message);
            }
            catch (JposException e)
            {
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
                MessageDialogFragment.showDialog(FragmentManager, "Exception", "Exception in Info: " + e.Message);
            }
        }
示例#15
0
        private void info()
        {
            string message;

            try
            {
                message = "deviceServiceDescription: " + cashDrawer.DeviceServiceDescription + "\ndeviceServiceVersion: " + cashDrawer.DeviceServiceVersion + "\nphysicalDeviceDescription: " + cashDrawer.PhysicalDeviceDescription + "\nphysicalDeviceName: " + cashDrawer.PhysicalDeviceName + "\npowerState: " + MainActivity.getPowerStateString(cashDrawer.PowerState);
                MessageDialogFragment.showDialog(FragmentManager, "Info", message);
            }
            catch (JposException e)
            {
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
                MessageDialogFragment.showDialog(FragmentManager, "Exception", "Exception in Info: " + e.Message);
            }
        }
示例#16
0
 public override void onCheckedChanged(CompoundButton buttonView, bool isChecked)
 {
     try
     {
         if (buttonView.Id == R.id.checkBoxDeviceEnabled)
         {
             smartCardRW.DeviceEnabled = isChecked;
             if (isChecked)
             {
                 smartCardRW.SCSlot = 0x01 << (sizeof(int) - 1);
             }
         }
     }
     catch (JposException e)
     {
         Console.WriteLine(e.ToString());
         Console.Write(e.StackTrace);
         MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
     }
 }
示例#17
0
        public virtual void onClick(View v)
        {
            switch (v.Id)
            {
            case R.id.buttonBrowse:
                FileListDialogFragment.showDialog(FragmentManager);
                break;

            case R.id.buttonGo:
                try
                {
                    posPrinter.updateFirmware(fileNameEditText.Text.ToString());
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;
            }
        }
示例#18
0
 public override void onCheckedChanged(CompoundButton buttonView, bool isChecked)
 {
     try
     {
         cashDrawer.DeviceEnabled = isChecked;
     }
     catch (JposException e)
     {
         Console.WriteLine(e.ToString());
         Console.Write(e.StackTrace);
         try
         {
             cashDrawer.DeviceEnabled = !isChecked;
         }
         catch (JposException e1)
         {
             // TODO Auto-generated catch block
             Console.WriteLine(e1.ToString());
             Console.Write(e1.StackTrace);
         }
         MessageDialogFragment.showDialog(FragmentManager, "Exception", e.Message);
     }
 }
示例#19
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: @Override public void dataOccurred(final jpos.events.DataEvent e)
        public override void dataOccurred(DataEvent e)
        {
            Activity.runOnUiThread(() =>
            {
                try
                {
                    refreshFields();

                    track1DataLengthTextView.Text = Convert.ToString(e.Status & 0xff);
                    track2DataLengthTextView.Text = Convert.ToString((e.Status & 0xff00) >> 8);
                    track3DataLengthTextView.Text = Convert.ToString((e.Status & 0xff0000) >> 16);

                    deviceEnabledCheckBox.Checked    = msr.DeviceEnabled;
                    dataEventEnabledCheckBox.Checked = msr.DataEventEnabled;
                    autoDisableCheckBox.Checked      = msr.AutoDisable;
                }
                catch (JposException e)
                {
                    e.printStackTrace();
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
            });
        }
        public override void onClick(View v)
        {
            string data      = dataEditText.Text.ToString();
            int    symbology = Symbology;

            try
            {
                int height = 0;
                if (heightEditText.Enabled)
                {
                    height = Convert.ToInt32(heightEditText.Text.ToString());
                }

                int width = 0;
                if (widthEditText.Enabled)
                {
                    width = Convert.ToInt32(widthEditText.Text.ToString());
                }

                int alignment    = Alignment;
                int textPosition = TextPosition;

                if (symbology == POSPrinterConst.PTR_BCS_MAXICODE)
                {
                    string dummyHeader = StringHelperClass.NewString(new sbyte[] { (sbyte)'[', (sbyte)')', (sbyte)'>', 0x1e, (sbyte)'0', (sbyte)'1', 0x1d, (sbyte)'9', (sbyte)'6', (sbyte)'1', (sbyte)'2', (sbyte)'3', (sbyte)'4', (sbyte)'5', (sbyte)'6', (sbyte)'7', (sbyte)'8', (sbyte)'9', 0x1d, (sbyte)'0', (sbyte)'0', (sbyte)'7', 0x1d, (sbyte)'2', (sbyte)'5', (sbyte)'0', 0x1d });
                    data = dummyHeader + data;
                }

                posPrinter.printBarCode(POSPrinterConst.PTR_S_RECEIPT, data, symbology, height, width, alignment, textPosition);
            }
//JAVA TO C# CONVERTER TODO TASK: There is no equivalent in C# to Java 'multi-catch' syntax:
            catch (NumberFormatException | JposException e)
            {
                e.printStackTrace();
                MessageDialogFragment.showDialog(FragmentManager, "Exception", e.Message);
            }
        }
示例#21
0
 public OnClickListenerAnonymousInnerClassHelper(MessageDialogFragment outerInstance)
 {
     this.outerInstance = outerInstance;
 }
        public override void onClick(View v)
        {
            switch (v.Id)
            {
            case R.id.buttonOpen:
                string logicalDeviceName = logicalNameEditText.Text.ToString();
                try
                {
                    posPrinter.open(logicalDeviceName);
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;

            case R.id.buttonClaim:
                try
                {
                    posPrinter.claim(0);
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;

            case R.id.buttonRelease:
                try
                {
                    posPrinter.release();
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;

            case R.id.buttonClose:
                try
                {
                    posPrinter.close();
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;

            case R.id.buttonInfo:
                info();
                break;

            case R.id.buttonCheckHealth:
                checkHealth();
                break;
            }
        }
        public virtual void onClick(string title, string text)
        {
            if (title.Equals("Escape sequences"))
            {
                sendToPrinterEditText.append(text);
            }
            else
            {
                try
                {
                    int characterSet = Convert.ToInt32(text);
                    posPrinter.CharacterSet = characterSet;

                    switch (characterSet)
                    {
                    case 437:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page437));
                        break;

                    case 737:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page737));
                        break;

                    case 775:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page775));
                        break;

                    case 850:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page850));
                        break;

                    case 852:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page852));
                        break;

                    case 855:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page855));
                        break;

                    case 857:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page857));
                        break;

                    case 858:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page858));
                        break;

                    case 860:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page860));
                        break;

                    case 862:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page862));
                        break;

                    case 863:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page863));
                        break;

                    case 864:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page864));
                        break;

                    case 865:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page865));
                        break;

                    case 866:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page866));
                        break;

                    case 928:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page928));
                        break;

                    case 1250:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_windows1250));
                        break;

                    case 1251:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_windows1251));
                        break;

                    case 1252:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_windows1252));
                        break;

                    case 1253:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_windows1253));
                        break;

                    case 1254:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_windows1254));
                        break;

                    case 1255:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_windows1255));
                        break;

                    case 1256:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_windows1256));
                        break;

                    case 1257:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_windows1257));
                        break;

                    case 1258:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_windows1258));
                        break;

                    case 7065:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_farsi));
                        break;

                    case 7565:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_katakana));
                        break;

                    case 7572:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_khmer_cambodia));
                        break;

                    case 8411:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_thai11));
                        break;

                    case 8414:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_thai14));
                        break;

                    case 8416:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_thai16));
                        break;

                    case 8418:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_thai18));
                        break;

                    case 8442:
                        posPrinter.printNormal(POSPrinterConst.PTR_S_RECEIPT, getString([email protected]_page_thai42));
                        break;
                    }
                }
//JAVA TO C# CONVERTER TODO TASK: There is no equivalent in C# to Java 'multi-catch' syntax:
                catch (NumberFormatException | JposException e)
                {
                    e.printStackTrace();
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
            }
        }
示例#24
0
        public override void onClick(View v)
        {
            switch (v.Id)
            {
            case R.id.buttonOpen:
                string logicalDeviceName = logicalNameEditText.Text.ToString();
                try
                {
                    cashDrawer.open(logicalDeviceName);
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }

                try
                {
                    deviceEnabledCheckBox.Checked = cashDrawer.DeviceEnabled;
                }
                catch (JposException e)
                {
                    // TODO Auto-generated catch block
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                }
                break;

            case R.id.buttonClaim:
                try
                {
                    cashDrawer.claim(0);
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;

            case R.id.buttonRelease:
                try
                {
                    cashDrawer.release();
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;

            case R.id.buttonClose:
                try
                {
                    cashDrawer.close();
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;

            case R.id.buttonInfo:
                info();
                break;

            case R.id.buttonCheckHealth:
                checkHealth();
                break;

            case R.id.buttonOpenDrawer:
                try
                {
                    cashDrawer.openDrawer();
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;

            case R.id.buttonGetDrawerOpened:
                try
                {
                    if (cashDrawer.DrawerOpened)
                    {
                        deviceMessagesTextView.append("Cash drawer is open.\n");
                    }
                    else
                    {
                        deviceMessagesTextView.append("Cash drawer is closed.\n");
                    }
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;
            }
        }
示例#25
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void info() throws jpos.JposException
        private void info()
        {
            string message = "deviceServiceDescription: " + msr.DeviceServiceDescription + "\ndeviceServiceVersion: " + msr.DeviceServiceVersion + "\nphysicalDeviceDescription: " + msr.PhysicalDeviceDescription + "\nphysicalDeviceName: " + msr.PhysicalDeviceName + "\npowerState: " + MainActivity.getPowerStateString(msr.PowerState) + "\ncapDataEncryption: " + getDataEncryptionString(msr.CapDataEncryption) + "\ndataEncryptionAlgorithm: " + getDataEncryptionString(msr.DataEncryptionAlgorithm) + "\ntracksToRead: " + getTrackToReadString(msr.TracksToRead);

            MessageDialogFragment.showDialog(FragmentManager, "Info", message);
        }
			public OnClickListenerAnonymousInnerClassHelper(MessageDialogFragment outerInstance)
			{
				this.outerInstance = outerInstance;
			}
示例#27
0
        public override void onClick(View v)
        {
            switch (v.Id)
            {
            case R.id.buttonOpen:
                string logicalDeviceName = logicalNameEditText.Text.ToString();
                try
                {
                    smartCardRW.open(logicalDeviceName);
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;

            case R.id.buttonClaim:
                try
                {
                    smartCardRW.claim(0);
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;

            case R.id.buttonRelease:
                try
                {
                    smartCardRW.release();
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;

            case R.id.buttonClose:
                try
                {
                    smartCardRW.close();
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;

            case R.id.buttonInfo:
                info();
                break;

            case R.id.buttonCheckHealth:
                checkHealth();
                break;

            case R.id.buttonReadData:
                string[] data  = new string[] { StringHelperClass.NewString(new sbyte[] { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40 }) };
                int[]    count = new int[1];

                try
                {
                    smartCardRW.readData(SmartCardRWConst.SC_READ_DATA, count, data);
                    readDataTextView.Text = BXLUtility.toHexString(data[0].GetBytes());
                }
                catch (JposException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                    readDataTextView.Text = "";
                    MessageDialogFragment.showDialog(FragmentManager, "Excepction", e.Message);
                }
                break;
            }
        }