private void ListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e) { ListView listView = sender as ListView; Java.Lang.Object itemObject = listView.GetItemAtPosition(e.Position); SimpleListItem2View item = Tools.Cast <SimpleListItem2View>(itemObject); string[] actions = { "Zurückspielen", "Löschen" }; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle(item.Heading); builder.SetItems(actions, (sender2, args) => { switch (args.Which) { case 0: // Zurückspielen Intent intent = new Intent(); intent.PutExtra("FullName", item.Tag.ToString()); this.SetResult(Result.Ok, intent); this.OnBackPressed(); break; case 1: // Löschen this.DeleteBackup(item.Tag.ToString()); break; } return; }); builder.Show(); }
private void ShowFileList() { try { var fileList = new DirectoryInfo(this.path).GetFiles(this.searchPattern); this.items = new List <SimpleListItem2View>(); foreach (FileInfo file in fileList) { var item = new SimpleListItem2View(); item.Heading = Path.GetFileNameWithoutExtension(file.FullName); item.SubHeading = Tools.ToFuzzyByteString(file.Length); item.Tag = file.FullName; items.Add(item); } var listView = FindViewById <ListView>(Resource.Id.SelectFile); var listAdapter = new SimpleListItem2Adapter(this, items); listView.Adapter = listAdapter; } catch (Exception e) { var pathView = FindViewById <TextView>(Resource.Id.SelectFile_Message); pathView.Visibility = ViewStates.Visible; pathView.Text = e.Message; } }