Exemplo n.º 1
0
        public async System.Threading.Tasks.Task getAdapter()
        {
            try
            {
                Log.Error(nonetwork, "getAdapter try: ");
                GetDevices GD = new GetDevices();
                if (listDevices != null)
                {
                    listDevices.Clear();
                }

                listDevices = await GD.GetDeviceList();

                Log.Error(nonetwork, "listDevices count: " + listDevices.Count);
                if (listDevices == null)
                {
                    Log.Error(nonetwork, "getAdapter Listdevice: null");
                    Toast.MakeText(this, "No devices found! No Wlan on? wrong network?", ToastLength.Long).Show();
                    AlertDialog.Builder alert = new AlertDialog.Builder(this);

                    alert.SetTitle("No network");
                    alert.SetMessage("Recreating application...");
                    alert.SetPositiveButton("OK", (senderAlert, args) =>
                    {
                        this.Recreate();
                    });
                    Dialog dialog = alert.Create();
                    dialog.Show();
                }
                else
                {
                    Log.Error(nonetwork, "getAdapter Listdevice: Else");
                    adapter           = new CustomListAdapter(this, listDevices);
                    lvDevices.Adapter = adapter;
                }
            }
            catch (Exception exce)
            {
                Log.Error(nonetwork, "getAdapter catch: " + exce);
                Toast.MakeText(this, "No devices found! No Wlan? Wrong network?", ToastLength.Long).Show();
            }
        }
Exemplo n.º 2
0
 public void updateList(CustomListAdapter customadapter)
 {
     //lvDevices = FindViewById<ListView>(Android.Resource.Id.List);
     //lvDevices.Invalidate();
     //lvDevices.Adapter = customadapter;
 }