public static string ReadFullSerial(this ShtrihFiscalPrinter printer) { String[] lines = new String[1]; printer.GetData(FiscalPrinterConst.FptrGdPrinterId, null, lines); return(lines[0]); }
public async void ConnectMePlz() { var dialog = ProgressDialog.Show(this, "Connecting to device", "Please wait...", true); dialog.Show(); var tbNetworkAddress = FindViewById <EditText>(Resource.Id.tbNetworkAddress); try { SysUtils.FilesPath = ApplicationContext.FilesDir.AbsolutePath; JposConfig.configure("ShtrihFptr", tbNetworkAddress.Text, ApplicationContext, "2", "0"); var sw = Stopwatch.StartNew(); var serial = await Task.Run(() => { using (var printer = new ShtrihFiscalPrinter(new FiscalPrinter())) { printer.Open("ShtrihFptr"); printer.Claim(3000); printer.DeviceEnabled = true; return(printer.ReadFullSerial()); } }); sw.Stop(); ShowMessage($"Connected to {serial} in {sw.ElapsedMilliseconds()} мс"); } catch (Java.Lang.Exception e) { Log.Error(TAG, e.ToString()); ShowMessage(e.Message); } catch (Exception e) { Log.Error(TAG, e.ToString()); ShowMessage(e.Message); } finally { dialog.Dismiss(); } }