protected internal override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_settings; bxlConfigLoader = new BXLConfigLoader(this); arrayAdapter = new ArrayAdapter <string>(this, android.R.layout.simple_list_item_1); ListView listView = (ListView)findViewById(R.id.listView1); listView.Adapter = arrayAdapter; registerForContextMenu(listView); try { bxlConfigLoader.openFile(); //JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET: //ORIGINAL LINE: java.util.List<?> entries = bxlConfigLoader.getEntries(); IList <?> entries = bxlConfigLoader.Entries; foreach (object entry in entries) { arrayAdapter.add(((JposEntry)entry).LogicalName); } } catch (Exception e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); bxlConfigLoader.newFile(); } }
protected internal override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_settings; bxlConfigLoader = new BXLConfigLoader(this); arrayAdapter = new ArrayAdapter<string>(this, android.R.layout.simple_list_item_1); ListView listView = (ListView) findViewById(R.id.listView1); listView.Adapter = arrayAdapter; registerForContextMenu(listView); try { bxlConfigLoader.openFile(); //JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET: //ORIGINAL LINE: java.util.List<?> entries = bxlConfigLoader.getEntries(); IList<?> entries = bxlConfigLoader.Entries; foreach (object entry in entries) { arrayAdapter.add(((JposEntry) entry).LogicalName); } } catch (Exception e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); bxlConfigLoader.newFile(); } }
public virtual void onClick(bool isModified, EntryInfo entryInfo) { string[] deviceCategories = Resources.getStringArray(R.array.device_categories); int deviceCategory = 0; if (entryInfo.DeviceCategory.Equals(deviceCategories[0])) { deviceCategory = BXLConfigLoader.DEVICE_CATEGORY_CASH_DRAWER; } else if (entryInfo.DeviceCategory.Equals(deviceCategories[1])) { deviceCategory = BXLConfigLoader.DEVICE_CATEGORY_MSR; } else if (entryInfo.DeviceCategory.Equals(deviceCategories[2])) { deviceCategory = BXLConfigLoader.DEVICE_CATEGORY_POS_PRINTER; } else if (entryInfo.DeviceCategory.Equals(deviceCategories[3])) { deviceCategory = BXLConfigLoader.DEVICE_CATEGORY_SMART_CARD_RW; } string[] deviceBuses = Resources.getStringArray(R.array.device_bus); int deviceBus = 0; if (entryInfo.DeviceBus.Equals(deviceBuses[0])) { deviceBus = BXLConfigLoader.DEVICE_BUS_BLUETOOTH; } else if (entryInfo.DeviceBus.Equals(deviceBuses[1])) { deviceBus = BXLConfigLoader.DEVICE_BUS_ETHERNET; } else if (entryInfo.DeviceBus.Equals(deviceBuses[2])) { deviceBus = BXLConfigLoader.DEVICE_BUS_USB; } else if (entryInfo.DeviceBus.Equals(deviceBuses[3])) { deviceBus = BXLConfigLoader.DEVICE_BUS_WIFI; } else if (entryInfo.DeviceBus.Equals(deviceBuses[4])) { deviceBus = BXLConfigLoader.DEVICE_BUS_WIFI_DIRECT; } if (isModified) { bxlConfigLoader.modifyEntry(entryInfo.LogicalName, deviceBus, entryInfo.Address); } else { try { bxlConfigLoader.addEntry(entryInfo.LogicalName, deviceCategory, entryInfo.ProductName, deviceBus, entryInfo.Address); arrayAdapter.add(entryInfo.LogicalName); } catch (System.ArgumentException e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); Toast.makeText(this, e.Message, Toast.LENGTH_SHORT).show(); } } }
protected internal override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); // Setup the window requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); ContentView = R.layout.device_list; //��ʾ�б���� // Set result CANCELED incase the user backs out Result = Activity.RESULT_CANCELED; // Initialize the button to perform device discovery Button scanButton = (Button)findViewById(R.id.button_scan); scanButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this); // Initialize array adapters. One for already paired devices and // one for newly discovered devices mPairedDevicesArrayAdapter = new ArrayAdapter <string>(this, R.layout.device_name); mNewDevicesArrayAdapter = new ArrayAdapter <string>(this, R.layout.device_name); // Find and set up the ListView for paired devices ListView pairedListView = (ListView)findViewById(R.id.paired_devices); pairedListView.Adapter = mPairedDevicesArrayAdapter; pairedListView.OnItemClickListener = mDeviceClickListener; // Find and set up the ListView for newly discovered devices ListView newDevicesListView = (ListView)findViewById(R.id.new_devices); newDevicesListView.Adapter = mNewDevicesArrayAdapter; newDevicesListView.OnItemClickListener = mDeviceClickListener; // Register for broadcasts when a device is discovered IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); this.registerReceiver(mReceiver, filter); // Register for broadcasts when discovery has finished filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); this.registerReceiver(mReceiver, filter); mService = new BluetoothService(this, null); // Get a set of currently paired devices ISet <BluetoothDevice> pairedDevices = mService.PairedDev; // If there are paired devices, add each one to the ArrayAdapter if (pairedDevices.Count > 0) { findViewById(R.id.title_paired_devices).Visibility = View.VISIBLE; foreach (BluetoothDevice device in pairedDevices) { mPairedDevicesArrayAdapter.add(device.Name + "\n" + device.Address); } } else { string noDevices = Resources.getText([email protected]_paired).ToString(); mPairedDevicesArrayAdapter.add(noDevices); } }