public override void onItemClick <T1>(AdapterView <T1> parent, View view, int position, long id) { string device = ((TextView)view).Text.ToString(); logicalName = device.Substring(0, device.IndexOf(DEVICE_ADDRESS_START, StringComparison.Ordinal)); string address = StringHelperClass.SubstringSpecial(device, device.IndexOf(DEVICE_ADDRESS_START, StringComparison.Ordinal) + DEVICE_ADDRESS_START.Length, device.IndexOf(DEVICE_ADDRESS_END, StringComparison.Ordinal)); try { foreach (object entry in bxlConfigLoader.Entries) { JposEntry jposEntry = (JposEntry)entry; bxlConfigLoader.removeEntry(jposEntry.LogicalName); } } catch (Exception e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } try { bxlConfigLoader.addEntry(logicalName, BXLConfigLoader.DEVICE_CATEGORY_POS_PRINTER, logicalName, BXLConfigLoader.DEVICE_BUS_BLUETOOTH, address); bxlConfigLoader.saveFile(); } catch (Exception e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } }
protected internal override void onStop() { base.onStop(); try { bxlConfigLoader.saveFile(); Toast.makeText(this, "File saved", Toast.LENGTH_SHORT).show(); } catch (Exception e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); Toast.makeText(this, e.Message, Toast.LENGTH_SHORT).show(); } }