public override bool Action(string action) { bool result = base.Action(action); if (result) { using (SelectOnNLDistanceForm dlg = new SelectOnNLDistanceForm()) { if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Core.Geocaches.BeginUpdate(); if (dlg.radioButtonNewSearch.Checked) { //reset current foreach (Framework.Data.Geocache gc in Core.Geocaches) { gc.Selected = false; } } List <Framework.Data.Geocache> gcList; if (dlg.radioButtonNewSearch.Checked) { gcList = (from Framework.Data.Geocache a in Core.Geocaches select a).ToList(); } else if (dlg.radioButtonWithinSelection.Checked) { gcList = (from Framework.Data.Geocache a in Core.Geocaches where a.Selected select a).ToList(); } else { gcList = (from Framework.Data.Geocache a in Core.Geocaches where !a.Selected select a).ToList(); } _minValue = (double)dlg.numericUpDownMin.Value; _maxValue = (double)dlg.numericUpDownMax.Value; foreach (var gc in gcList) { gc.Selected = inRange(gc.GetCustomAttribute(GeocacheDistance.CUSTOM_ATTRIBUTE) as string); } Core.Geocaches.EndUpdate(); } } } return(result); }
public override bool Action(string action) { bool result = base.Action(action); if (result) { using (SelectOnNLDistanceForm dlg = new SelectOnNLDistanceForm()) { if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Core.Geocaches.BeginUpdate(); if (dlg.radioButtonNewSearch.Checked) { //reset current foreach (Framework.Data.Geocache gc in Core.Geocaches) { gc.Selected = false; } } List<Framework.Data.Geocache> gcList; if (dlg.radioButtonNewSearch.Checked) { gcList = (from Framework.Data.Geocache a in Core.Geocaches select a).ToList(); } else if (dlg.radioButtonWithinSelection.Checked) { gcList = (from Framework.Data.Geocache a in Core.Geocaches where a.Selected select a).ToList(); } else { gcList = (from Framework.Data.Geocache a in Core.Geocaches where !a.Selected select a).ToList(); } _minValue = (double)dlg.numericUpDownMin.Value; _maxValue = (double)dlg.numericUpDownMax.Value; foreach(var gc in gcList) { gc.Selected = inRange(gc.GetCustomAttribute(GeocacheDistance.CUSTOM_ATTRIBUTE) as string); } Core.Geocaches.EndUpdate(); } } } return result; }