Beispiel #1
0
            public void print(string pData, Encoding pEnc)
            {
                IPrinter handler = null;

                string printer_ = CurrentVersion.ENV.getPrinter();

                if (printer_.Contains(":"))
                {
                    handler = new PrintHandlerTcp(pEnc);
                }
                else
                {
                    handler = new PrintHandlerBT(pEnc);
                }



                try
                {
                    handler.open();

                    handler.writeLine(" ", true);

                    handler.write(pData);

                    // handler.writeLine(" ", true);

                    //

                    //
                    if (CurrentVersion.ENV.getEnvBool("AUTOCUT", false))
                    {
                        string GS  = Convert.ToString((char)29);
                        string ESC = Convert.ToString((char)27);

                        string COMMAND = "";
                        COMMAND  = ESC + "@";
                        COMMAND += GS + "V" + (char)1;

                        handler.write(COMMAND);
                    }
                }
                catch (Exception exc)
                {
                    ToolMobile.setException(exc);
                }
                finally
                {
                    handler.close();
                }
            }
Beispiel #2
0
        public static void startFormForResult(Type type)
        {
            try
            {
                ActivityExt x = getContextLast();

                Intent intent = new Intent(x, type);

                x.StartActivityForResult(intent, 0);
            }
            catch (Exception exc)
            {
                ToolMobile.setException(exc);
                throw new MyExceptionInner(MessageCollection.T_MSG_ERROR_INNER, exc);
            }
        }
Beispiel #3
0
        public static void startForm(Type type, string[] args, Java.IO.ISerializable[] vals)
        {
            try
            {
                ActivityExt x      = getContextLast();
                Intent      intent = new Intent(x, type);
                if (args != null && vals != null)
                {
                    for (int i = 0; i < Math.Min(args.Length, vals.Length); ++i)
                    {
                        intent.PutExtra(args[i], vals[i]);
                    }
                }

                x.StartActivity(intent);
            }
            catch (Exception exc)
            {
                ToolMobile.setException(exc);
                throw new MyExceptionInner(MessageCollection.T_MSG_ERROR_INNER, exc);
            }
        }
        async static void startScan(Action <string> barcode)
        {
            try
            {
                var opt = new ZXing.Mobile.MobileBarcodeScanningOptions();
                opt.PossibleFormats.Clear();
                opt.PossibleFormats.Add(ZXing.BarcodeFormat.EAN_13);
                opt.PossibleFormats.Add(ZXing.BarcodeFormat.EAN_8);
                opt.PossibleFormats.Add(ZXing.BarcodeFormat.CODE_128);


                var scanner = new ZXing.Mobile.MobileBarcodeScanner();
                var result  = await scanner.Scan(opt);

                if (result != null && barcode != null)
                {
                    barcode.Invoke(result.Text);
                }
            }
            catch (Exception exc)
            {
                ToolMobile.setException(exc);
            }
        }