public LocationManagerDelegate(MKMapView mapview, FieldLocationScreen controller) { _mapview = mapview; _controller = controller; }
public LoggItemTableSource(LoggItemScreen controller) { var jeger = new Jeger(); if(JaktLoggApp.instance.CurrentJakt.JegerIds.Count > 0) jeger = JaktLoggApp.instance.GetJeger(JaktLoggApp.instance.CurrentJakt.JegerIds[0]); _controller = controller; var section1 = new SectionMapping("", ""); var section2 = new SectionMapping("", ""); var section3 = new SectionMapping("Ekstra felter", ""); var sectionSlett = new SectionMapping("", ""); section1.Rows.Add(new RowItemMapping { Label = "Felt/sett vilt", GetValue = () => { var lbl = ""; if(loggItem.ArtId > 0) lbl = loggItem.Treff + " " + JaktLoggApp.instance.GetArt(loggItem.ArtId).Navn + " på " + loggItem.Skudd + " skudd"; else lbl = loggItem.Skudd + " skudd, " + loggItem.Treff + " treff"; if(loggItem.Sett > 0) lbl += ", " + loggItem.Sett + " sett "; return lbl; }, RowSelected = () => { var fieldScreen = new FieldLoggCatch("Felt/sett vilt", screen => { loggItem.ArtId = screen.CurrentArtId; loggItem.Treff = screen.CurrentHits; loggItem.Skudd = screen.CurrentShots; loggItem.Sett = screen.CurrentSeen; _controller.Refresh(); }); fieldScreen.CurrentArtId = loggItem.ArtId; fieldScreen.CurrentHits = loggItem.Treff; fieldScreen.CurrentShots = loggItem.Skudd; fieldScreen.CurrentSeen = loggItem.Sett; _controller.NavigationController.PushViewController(fieldScreen, true); }, ImageFile = "Images/Icons/target.png" }); section1.Rows.Add(new RowItemMapping { Label = "Posisjon", GetValue = () => { return string.IsNullOrEmpty(loggItem.Latitude) ? "Ikke satt" : "Se i kart"; }, RowSelected = () => { var fieldScreen = new FieldLocationScreen(loggItem, screen => { loggItem.Latitude = screen.Latitude; loggItem.Longitude = screen.Longitude; _controller.Refresh(); }); fieldScreen.Latitude = loggItem.Latitude; fieldScreen.Longitude = loggItem.Longitude; _controller.NavigationController.PushViewController(fieldScreen, true); }, ImageFile = "Images/Icons/pin.png" }); section1.Rows.Add(new RowItemMapping { Label = "Jeger", GetValue = () => { if(loggItem.JegerId == 0 && JaktLoggApp.instance.CurrentJakt.JegerIds.Count == 1){ loggItem.JegerId = jeger.ID; _controller.Refresh(); } else if(loggItem.JegerId == 0) return string.Empty; else jeger = JaktLoggApp.instance.GetJeger(loggItem.JegerId); return jeger.Navn; }, RowSelected = () => { var jegerlist = CreateSingleSelectJegerItems(); var fieldScreen = new FieldSingleChoiceListScreen("Velg jeger", jegerlist, screen => { loggItem.JegerId = screen.SelectedKey == "" ? 0 : Int32.Parse(screen.SelectedKey); _controller.Refresh(); }); fieldScreen.SelectedKey = loggItem.JegerId.ToString(); _controller.NavigationController.PushViewController(fieldScreen, true); }, ImageFile = "Images/Icons/user.png" }); section2.Rows.Add(new RowItemMapping { Label = "Tidspunkt", GetValue = () => { return loggItem.Dato.Day + "/" + loggItem.Dato.Month + " " + loggItem.Dato.Hour +":"+loggItem.Dato.Minute; }, RowSelected = () => { var fieldScreen = new FieldDatePickerScreen(screen => { loggItem.Dato = screen.Date; _controller.Refresh(); }); fieldScreen.Date = new DateTime(JaktLoggApp.instance.CurrentJakt.DatoFra.Year, loggItem.Dato.Month, loggItem.Dato.Day, loggItem.Dato.Hour, loggItem.Dato.Minute, loggItem.Dato.Second); fieldScreen.Mode = UIDatePickerMode.DateAndTime; fieldScreen.Title = "Tidspunkt"; _controller.NavigationController.PushViewController(fieldScreen, true); }, ImageFile = "Images/Icons/calendar.png" }); section2.Rows.Add(new RowItemMapping { Label = "Notater", GetValue = () => { return loggItem.Notes; }, RowSelected = () => { var fieldScreen = new FieldNotesScreen("Notater", screen => { loggItem.Notes = screen.Value; _controller.Refresh(); }); fieldScreen.Value = loggItem.Notes; _controller.NavigationController.PushViewController(fieldScreen, true); }, ImageFile = "Images/Icons/notepad.png" }); section2.Rows.Add(new RowItemMapping { Label = "Bilde", GetValue = () => { return loggItem != null && loggItem.ImagePath.Length > 0 ? "Vis / endre" : "Legg til"; }, RowSelected = () => { ShowImageView(); }, ImageFile = "Images/Icons/camera.png" }); /*section3.Rows.Add(new RowItemMapping { Label = "Værforhold", GetValue = () => { return loggItem.Weather; }, RowSelected = () => { var options = new List<SingleSelectRowItem>(); options.Add(new SingleSelectRowItem(){ Key = "Sol", TextLabel = "Soll" }); options.Add(new SingleSelectRowItem(){ Key = "Overskyet", TextLabel = "Overskyet" }); options.Add(new SingleSelectRowItem(){ Key = "Regn", TextLabel = "Regn" }); var fieldScreen = new FieldSingleChoiceListScreen("Værforhold", options, screen => { loggItem.Weather = screen.SelectedKey; _controller.Refresh(); }); _controller.NavigationController.PushViewController(fieldScreen, true); } });*/ foreach(var selectedLoggTypeId in JaktLoggApp.instance.SelectedLoggTypeIds) { var item = JaktLoggApp.instance.LoggTypeList.SingleOrDefault(i => i.Key == selectedLoggTypeId); switch(item.Navn){ case "Vær": section3.Rows.Add(new RowItemMapping { Label = "Værforhold", GetValue = () => { return loggItem.Weather; }, RowSelected = () => { var options = new List<SingleSelectRowItem>(); options.Add(new SingleSelectRowItem(){ Key = "Sol", TextLabel = "Sol" }); options.Add(new SingleSelectRowItem(){ Key = "Delvis skyet", TextLabel = "Delvis skyet" }); options.Add(new SingleSelectRowItem(){ Key = "Overskyet", TextLabel = "Overskyet" }); options.Add(new SingleSelectRowItem(){ Key = "Regn", TextLabel = "Regn" }); options.Add(new SingleSelectRowItem(){ Key = "Snø", TextLabel = "Snø" }); var fieldScreen = new FieldSingleChoiceListScreen("Værforhold", options, screen => { loggItem.Weather = screen.SelectedKey; _controller.Refresh(); }); fieldScreen.SelectedKey = loggItem.Weather; _controller.NavigationController.PushViewController(fieldScreen, true); } }); break; case "Kjønn": section3.Rows.Add(new RowItemMapping { Label = "Kjønn", GetValue = () => { return loggItem.Gender; }, RowSelected = () => { var options = new List<SingleSelectRowItem>(); options.Add(new SingleSelectRowItem(){ Key = "Hannkjønn", TextLabel = "Hannkjønn" }); options.Add(new SingleSelectRowItem(){ Key = "Hunnkjønn", TextLabel = "Hunnkjønn" }); var fieldScreen = new FieldSingleChoiceListScreen("Kjønn", options, screen => { loggItem.Gender = screen.SelectedKey; _controller.Refresh(); }); fieldScreen.SelectedKey = loggItem.Gender; _controller.NavigationController.PushViewController(fieldScreen, true); } }); break; case "Tagger": section3.Rows.Add(new RowItemMapping { Label = "Tagger på geviret", GetValue = () => { return loggItem.Tags == 0 ? "" : loggItem.Tags.ToString(); }, RowSelected = () => { var fieldScreen = new FieldNumberPickerScreen(screen => { loggItem.Tags = Int32.Parse(screen.Value); _controller.Refresh(); }); fieldScreen.Value = loggItem.Tags.ToString(); fieldScreen.Title = "Antall tagger på gevir"; fieldScreen.LabelExtension = " tagger"; _controller.NavigationController.PushViewController(fieldScreen, true); } }); break; case "Alder": section3.Rows.Add(new RowItemMapping { Label = "Alder", GetValue = () => { return loggItem.Age; }, RowSelected = () => { var options = new List<SingleSelectRowItem>(); options.Add(new SingleSelectRowItem(){ Key = "Kalv", TextLabel = "Kalv" }); options.Add(new SingleSelectRowItem(){ Key = "1 1/2 år", TextLabel = "1 1/2 år" }); options.Add(new SingleSelectRowItem(){ Key = "2 1/2 år og eldre", TextLabel = "2 1/2 år og eldre" }); var fieldScreen = new FieldSingleChoiceListScreen("Alder", options, screen => { loggItem.Age = screen.SelectedKey; _controller.Refresh(); }); fieldScreen.SelectedKey = loggItem.Age; controller.NavigationController.PushViewController(fieldScreen, true); } }); break; case "Vekt": section3.Rows.Add(new RowItemMapping { Label = "Vekt", GetValue = () => { return loggItem.Weight == 0 ? "" : loggItem.Weight + " kg"; }, RowSelected = () => { var fieldScreen = new FieldNumberPickerScreen(screen => { loggItem.Weight = Int32.Parse(screen.Value); _controller.Refresh(); }); fieldScreen.Value = loggItem.Weight.ToString(); fieldScreen.Title = "Vekt i kilo"; fieldScreen.LabelExtension = " kg"; _controller.NavigationController.PushViewController(fieldScreen, true); } }); break; case "Slaktevekt": section3.Rows.Add(new RowItemMapping { Label = "Slaktevekt", GetValue = () => { return loggItem.ButchWeight == 0 ? "" : loggItem.ButchWeight + " kg"; }, RowSelected = () => { var fieldScreen = new FieldNumberPickerScreen(screen => { loggItem.ButchWeight = Int32.Parse(screen.Value); _controller.Refresh(); }); fieldScreen.Value = loggItem.ButchWeight.ToString(); fieldScreen.Title = "Slaktevekt i kilo"; fieldScreen.LabelExtension = " kg"; _controller.NavigationController.PushViewController(fieldScreen, true); } }); break; case "Våpentype": section3.Rows.Add(new RowItemMapping { Label = "Våpentype", GetValue = () => { return loggItem.WeaponType; }, RowSelected = () => { var fieldScreen = new FieldStringScreen("Våpentype", screen => { loggItem.WeaponType = screen.Value; _controller.Refresh(); }); fieldScreen.Placeholder = "Skriv inn våpentype"; fieldScreen.Value = loggItem.WeaponType; //autosuggest: var autoitems = (from x in JaktLoggApp.instance.LoggList where x.WeaponType != string.Empty select x.WeaponType.ToUpper()).Distinct(); var autosuggests = new List<ItemCount>(); foreach(var autoitem in autoitems){ autosuggests.Add(new ItemCount{ Name = autoitem, Count = JaktLoggApp.instance.LoggList.Where(y => y.WeaponType.ToUpper() == autoitem).Count() }); } fieldScreen.AutoSuggestions = autosuggests.OrderByDescending( o => o.Count ).ToList(); _controller.NavigationController.PushViewController(fieldScreen, true); }, ImageFile = "" }); break; case "Hund": section3.Rows.Add(new RowItemMapping { Label = "Hund", GetValue = () => { return loggItem.Dog; }, RowSelected = () => { var fieldScreen = new FieldStringScreen("Hund", screen => { loggItem.Dog = screen.Value; _controller.Refresh(); }); fieldScreen.Placeholder = "Skriv inn hundenavn"; fieldScreen.Value = loggItem.Dog; //autosuggest: var autoitems = (from x in JaktLoggApp.instance.LoggList where x.Dog != string.Empty select x.Dog.ToUpper()).Distinct(); var autosuggests = new List<ItemCount>(); foreach(var autoitem in autoitems){ autosuggests.Add(new ItemCount{ Name = autoitem, Count = JaktLoggApp.instance.LoggList.Where(y => y.Dog.ToUpper() == autoitem).Count() }); } fieldScreen.AutoSuggestions = autosuggests.OrderByDescending( o => o.Count ).ToList(); _controller.NavigationController.PushViewController(fieldScreen, true); }, ImageFile = "" }); break; } } if(!_controller.IsNewItem){ sectionSlett.Rows.Add(new RowItemMapping { Label = "Slett loggføring", GetValue = () => { return ""; } }); } sections.Add(section1); sections.Add(section2); if(section3.Rows.Count > 0) sections.Add(section3); sections.Add(sectionSlett); }
public MapViewDelegate (FieldLocationScreen controller):base() { _controller = controller; }
public LoggItemTableSource(LoggItemScreen controller, Logg logg) { loggItem = logg; _controller = controller; //views CellDelete = new CellDeleteButton(HandleDeleteButtonTouchUpInside); NSBundle.MainBundle.LoadNib("CellDeleteButton", CellDelete, null); delcell = CellDelete.Cell; headerLoggItemView = new HeaderLoggItem(loggItem); headerLoggItemView.HandleButtonImageTouchUpInside = HandleButtonImageTouchUpInside; headerLoggItemView.HandleButtonDogTouchUpInside = HandleButtonDogTouchUpInside; headerLoggItemView.HandleButtonJegerTouchUpInside = HandleButtonJegerTouchUpInside; //Sections and cells var section1 = new SectionMapping("", ""); var section2 = new SectionMapping("", ""); var section3 = new SectionMapping("", ""); var sectionSlett = new SectionMapping("", ""); #region fields section1.Rows.Add(new RowItemMapping { Label = Utils.Translate("log.header.results"), GetValue = () => { var lbl = ""; var art = JaktLoggApp.instance.GetArt(loggItem.ArtId); if(art != null) lbl = loggItem.Treff + " " + art.Navn + " / " + loggItem.Skudd + " " + Utils.Translate("shots"); else lbl = loggItem.Skudd + " "+ Utils.Translate("shots") +", " + loggItem.Treff + " "+ Utils.Translate("hits"); if(loggItem.Sett > 0) lbl += ", " + loggItem.Sett + " "+ Utils.Translate("seen") +" "; return lbl; }, RowSelected = () => { var fieldScreen = new FieldLoggCatch(Utils.Translate("log.header.results"), screen => { loggItem.ArtId = screen.CurrentArtId; loggItem.Treff = screen.CurrentHits; loggItem.Skudd = screen.CurrentShots; loggItem.Sett = screen.CurrentSeen; _controller.Refresh(); }); fieldScreen.CurrentArtId = loggItem.ArtId; fieldScreen.CurrentHits = loggItem.Treff; fieldScreen.CurrentShots = loggItem.Skudd; fieldScreen.CurrentSeen = loggItem.Sett; _controller.NavigationController.PushViewController(fieldScreen, true); }, ImageFile = "Images/Icons/target.png" }); section1.Rows.Add(new RowItemMapping { Label = Utils.Translate("log.header.position"), GetValue = () => { return string.IsNullOrEmpty(loggItem.Latitude) ? "-" : Utils.Translate("log.viewinmap"); }, RowSelected = () => { var fieldScreen = new FieldLocationScreen(loggItem, screen => { loggItem.Latitude = screen.Latitude; loggItem.Longitude = screen.Longitude; _controller.Refresh(); }); fieldScreen.Latitude = loggItem.Latitude; fieldScreen.Longitude = loggItem.Longitude; _controller.NavigationController.PushViewController(fieldScreen, true); }, ImageFile = "Images/Icons/pin.png" }); /* * var jeger = new Jeger(); if(JaktLoggApp.instance.CurrentJakt.JegerIds.Count > 0) jeger = JaktLoggApp.instance.GetJeger(JaktLoggApp.instance.CurrentJakt.JegerIds[0]); * section1.Rows.Add(new RowItemMapping { Label = "Jeger", GetValue = () => { if(loggItem.JegerId == 0 && JaktLoggApp.instance.CurrentJakt.JegerIds.Count == 1){ loggItem.JegerId = jeger.ID; _controller.Refresh(); } else if(loggItem.JegerId == 0) return string.Empty; else jeger = JaktLoggApp.instance.GetJeger(loggItem.JegerId); return jeger.Navn; }, RowSelected = () => { ShowJegerView(); }, ImageFile = "Images/Icons/user.png" }); section1.Rows.Add(new RowItemMapping { Label = "Hund", GetValue = () => { if(loggItem.DogId == 0) return string.Empty; return JaktLoggApp.instance.GetDog(loggItem.DogId).Navn; }, RowSelected = () => { ShowDogView(); }, ImageFile = "Images/Icons/Tabs/dog-paw.png" }); */ section2.Rows.Add(new RowItemMapping { Label = Utils.Translate("log.header.time"), GetValue = () => { return loggItem.Dato.ToLocalDateAndYearString(); }, RowSelected = () => { var fieldScreen = new FieldDatePickerScreen(screen => { loggItem.Dato = screen.Date; _controller.Refresh(); }); fieldScreen.Date = new DateTime(JaktLoggApp.instance.CurrentJakt.DatoFra.Year, loggItem.Dato.Month, loggItem.Dato.Day, loggItem.Dato.Hour, loggItem.Dato.Minute, loggItem.Dato.Second); fieldScreen.Mode = UIDatePickerMode.DateAndTime; fieldScreen.Title = Utils.Translate("log.header.time"); _controller.NavigationController.PushViewController(fieldScreen, true); }, ImageFile = "Images/Icons/calendar.png" }); section2.Rows.Add(new RowItemMapping { Label = Utils.Translate("log.header.notes"), GetValue = () => { return loggItem.Notes; }, RowSelected = () => { var fieldScreen = new FieldNotesScreen(Utils.Translate("log.header.notes"), screen => { loggItem.Notes = screen.Value; _controller.Refresh(); }); fieldScreen.Value = loggItem.Notes; _controller.NavigationController.PushViewController(fieldScreen, true); }, ImageFile = "Images/Icons/notepad.png" }); /* section2.Rows.Add(new RowItemMapping { Label = "Bilde", GetValue = () => { return loggItem != null && loggItem.ImagePath.Length > 0 ? "Vis / endre" : "Legg til"; }, RowSelected = () => { ShowImageView(); }, ImageFile = "Images/Icons/camera.png" }); */ /*section3.Rows.Add(new RowItemMapping { Label = "Værforhold", GetValue = () => { return loggItem.Weather; }, RowSelected = () => { var options = new List<SingleSelectRowItem>(); options.Add(new SingleSelectRowItem(){ Key = "Sol", TextLabel = "Soll" }); options.Add(new SingleSelectRowItem(){ Key = "Overskyet", TextLabel = "Overskyet" }); options.Add(new SingleSelectRowItem(){ Key = "Regn", TextLabel = "Regn" }); var fieldScreen = new FieldSingleChoiceListScreen("Værforhold", options, screen => { loggItem.Weather = screen.SelectedKey; _controller.Refresh(); }); _controller.NavigationController.PushViewController(fieldScreen, true); } });*/ foreach(var selectedLoggTypeId in JaktLoggApp.instance.SelectedLoggTypeIds) { var item = JaktLoggApp.instance.LoggTypeList.SingleOrDefault(i => i.Key == selectedLoggTypeId); if(item == null) continue; switch(item.Key){ case "Weather": section3.Rows.Add(new RowItemMapping { Label = Utils.Translate("log.header.weather"), GetValue = () => { return loggItem.Weather; }, RowSelected = () => { var fieldScreen = new FieldStringScreen(Utils.Translate("log.header.weather"), screen => { loggItem.Weather = screen.Value; _controller.Refresh(); }); fieldScreen.Placeholder = Utils.Translate("log.header.weather"); fieldScreen.Value = loggItem.Weather; //autosuggest: var autoitems = (from x in JaktLoggApp.instance.LoggList where x.Weather != string.Empty select x.Weather.ToUpper()).Distinct(); var autosuggests = new List<ItemCount>(); foreach(var autoitem in autoitems){ autosuggests.Add(new ItemCount{ Name = autoitem, Count = JaktLoggApp.instance.LoggList.Where(y => y.Weather.ToUpper() == autoitem).Count() }); } fieldScreen.AutoSuggestions = autosuggests.OrderByDescending( o => o.Count ).Take(15).ToList(); _controller.NavigationController.PushViewController(fieldScreen, true); } }); break; case "Gender": section3.Rows.Add(new RowItemMapping { Label = Utils.Translate("log.header.gender"), GetValue = () => { return loggItem.Gender; }, RowSelected = () => { var options = new List<SingleSelectRowItem>(); options.Add(new SingleSelectRowItem(){ Key = Utils.Translate("log.gender.male"), TextLabel = Utils.Translate("log.gender.male") }); options.Add(new SingleSelectRowItem(){ Key = Utils.Translate("log.gender.female"), TextLabel = Utils.Translate("log.gender.female") }); var fieldScreen = new FieldSingleChoiceListScreen(Utils.Translate("log.header.gender"), options, screen => { loggItem.Gender = screen.SelectedKey; _controller.Refresh(); }); fieldScreen.SelectedKey = loggItem.Gender; _controller.NavigationController.PushViewController(fieldScreen, true); } }); break; case "Tags": section3.Rows.Add(new RowItemMapping { Label = Utils.Translate("log.header.tags"), GetValue = () => { return loggItem.Tags == 0 ? "" : loggItem.Tags.ToString(); }, RowSelected = () => { var fieldScreen = new FieldNumberPickerScreen(screen => { loggItem.Tags = Int32.Parse(screen.Value); _controller.Refresh(); }); fieldScreen.Value = loggItem.Tags.ToString(); fieldScreen.Title = Utils.Translate("log.header.tags"); fieldScreen.LabelExtension = " " + Utils.Translate("log.tags"); _controller.NavigationController.PushViewController(fieldScreen, true); } }); break; case "Age": section3.Rows.Add(new RowItemMapping { Label = Utils.Translate("log.header.largeage"), GetValue = () => { return loggItem.Age; }, RowSelected = () => { var options = new List<SingleSelectRowItem>(); options.Add(new SingleSelectRowItem(){ Key = Utils.Translate("log.kalv.name"), TextLabel = Utils.Translate("log.kalv.name") }); options.Add(new SingleSelectRowItem(){ Key = Utils.Translate("log.kalv.age1"), TextLabel = Utils.Translate("log.kalv.age1") }); options.Add(new SingleSelectRowItem(){ Key = Utils.Translate("log.kalv.age2"), TextLabel = Utils.Translate("log.kalv.age2") }); var fieldScreen = new FieldSingleChoiceListScreen(Utils.Translate("log.header.largeage"), options, screen => { loggItem.Age = screen.SelectedKey; _controller.Refresh(); }); fieldScreen.SelectedKey = loggItem.Age; controller.NavigationController.PushViewController(fieldScreen, true); } }); break; case "Weight": section3.Rows.Add(new RowItemMapping { Label = Utils.Translate("log.header.weight"), GetValue = () => { return loggItem.Weight == 0 ? "" : loggItem.Weight + " kg"; }, RowSelected = () => { var fieldScreen = new FieldNumberPickerScreen(screen => { loggItem.Weight = Int32.Parse(screen.Value); _controller.Refresh(); }); fieldScreen.Value = loggItem.Weight.ToString(); fieldScreen.Title = Utils.Translate("log.header.weight"); fieldScreen.LabelExtension = " kg"; _controller.NavigationController.PushViewController(fieldScreen, true); } }); break; case "ButchWeight": section3.Rows.Add(new RowItemMapping { Label = Utils.Translate("log.header.butchweight"), GetValue = () => { return loggItem.ButchWeight == 0 ? "" : loggItem.ButchWeight + " kg"; }, RowSelected = () => { var fieldScreen = new FieldNumberPickerScreen(screen => { loggItem.ButchWeight = Int32.Parse(screen.Value); _controller.Refresh(); }); fieldScreen.Value = loggItem.ButchWeight.ToString(); fieldScreen.Title = Utils.Translate("log.header.butchweight"); fieldScreen.LabelExtension = " kg"; _controller.NavigationController.PushViewController(fieldScreen, true); } }); break; case "WeaponType": section3.Rows.Add(new RowItemMapping { Label = Utils.Translate("log.header.weapontype"), GetValue = () => { return loggItem.WeaponType; }, RowSelected = () => { var fieldScreen = new FieldStringScreen(Utils.Translate("log.header.weapontype"), screen => { loggItem.WeaponType = screen.Value; _controller.Refresh(); }); fieldScreen.Placeholder = Utils.Translate("log.writeweapontype"); fieldScreen.Value = loggItem.WeaponType; //autosuggest: var autoitems = (from x in JaktLoggApp.instance.LoggList where x.WeaponType != string.Empty select x.WeaponType.ToUpper()).Distinct(); var autosuggests = new List<ItemCount>(); foreach(var autoitem in autoitems){ autosuggests.Add(new ItemCount{ Name = autoitem, Count = JaktLoggApp.instance.LoggList.Where(y => y.WeaponType.ToUpper() == autoitem).Count() }); } fieldScreen.AutoSuggestions = autosuggests.OrderByDescending( o => o.Count ).ToList(); _controller.NavigationController.PushViewController(fieldScreen, true); }, ImageFile = "" }); break; } } #endregion if(!_controller.IsNewItem){ sectionSlett.Rows.Add(new RowItemMapping { Label = Utils.Translate("log.delete"), GetValue = () => { return ""; } }); } sections.Add(section1); sections.Add(section2); if(section3.Rows.Count > 0) sections.Add(section3); sections.Add(sectionSlett); foreach(var s in sections){ headers.Add(new HeaderTableSection(s.Header)); } }