protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.conectaralservidor); botonscan = FindViewById <FloatingActionButton>(Resource.Id.linearLayout2); listaelementos = FindViewById <ListView>(Resource.Id.listView1); var action = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.my_toolbar); SetSupportActionBar(action); SupportActionBar.SetDisplayHomeAsUpEnabled(true); //SupportActionBar.SetBackgroundDrawable(new ColorDrawable(Color.ParseColor("#2b2e30"))); if (Directory.Exists(Constants.CachePath)) { Directory.CreateDirectory(Constants.CachePath); } AnimationHelper.AnimateFAB(botonscan); //////////////////////////////////miselaneo /// if (File.Exists(Constants.CachePath + "/ips.json")) { var ipheader = SocketHelper.GetHostAddress().Split('.')[0]; try { mode = JsonConvert.DeserializeObject <IpData>(File.ReadAllText(Constants.CachePath + "/ips.json")); } catch (Exception) { File.Delete(Constants.CachePath + "/ips.json"); mode = new IpData("", new Dictionary <string, string>()); } if (estaon(mode.Ip)) { ultimaipescaneada = mode.Ip; } todasip = mode.Ips.Keys.ToList(); misips = mode.Ips.Keys.ToList().Where(aax => aax.StartsWith(ipheader)).ToList(); forscan = misips.Count; foreach (string prro in new List <string>(misips)) { new Thread(() => { estaon2(prro); }).Start(); } var adaptadol = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, new List <string> { "No hay elementos para mostrar.." }); RunOnUiThread(() => { var parcelable = listaelementos.OnSaveInstanceState(); listaelementos.Adapter = adaptadol; listaelementos.OnRestoreInstanceState(parcelable); }); #pragma warning disable CS0618 // El tipo o el miembro están obsoletos dialogoprogreso = new ProgressDialog(this); #pragma warning restore CS0618 // El tipo o el miembro están obsoletos dialogoprogreso.SetCanceledOnTouchOutside(false); dialogoprogreso.SetCancelable(false); dialogoprogreso.SetTitle("Cargando lista de servidores..."); dialogoprogreso.SetMessage("Por favor espere"); dialogoprogreso.Show(); new Thread(() => { remover(); }).Start(); } else { mode = new IpData("", new Dictionary <string, string>()); } /* textboxl.Text = prefs.GetString("ipanterior", null); * Thread proc = new Thread(new ThreadStart(tryear2)); * proc.Start();*/ listaelementos.ItemClick += (aaa, aasd) => { if (misips.Count > 0) { //SetActionBar(null); mode.Ip = misips[aasd.Position]; SocketHelper.SaveIps(mode); Intent activity2 = new Intent(this, typeof(Mainmenu)); activity2.PutExtra("MyData", misips[aasd.Position]); StartActivity(activity2); this.Finish(); } }; botonscan.Click += (aaaa, aaa) => { new Android.App.AlertDialog.Builder(this) .SetTitle("Agregar nuevo dispositivo") .SetMessage("Para agregar un se debe escanear un codigo el cual puede ser encontrado en el menu de conectar a clientes>boton de agregado (si es un host android) o abrir gestor de clientes(si el host es windows,mac,linux) luego presione escanear") .SetPositiveButton("Escanear", (aa, cdsf) => { escaneareir(); }) .SetNegativeButton("Cancelar", (asd, ffe) => { }).Create().Show(); }; if (!Directory.Exists(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist")) { Directory.CreateDirectory(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist"); } ////////////////////////////////////// // Create your application here }