private void DeleteZone(object sender, RoutedEventArgs e) { ZoneRestrictions selectedItem = (ZoneRestrictions)ZoneRestrictions.SelectedItem; if (selectedItem != null) { Plugin.Config.ZoneRestrictions.Remove(selectedItem); Plugin.Config.RefreshModel(); } }
private void AddNewGpsButton(object sender, RoutedEventArgs e) { foreach (Match item in Regex.Matches(GpsTextBox.Text, Utils.m_ScanPattern)) { ZoneRestrictions r = new ZoneRestrictions(); string value = item.Groups[1].Value; double value2; double value3; double value4; try { value2 = double.Parse(item.Groups[2].Value, CultureInfo.InvariantCulture); value2 = Math.Round(value2, 2); value3 = double.Parse(item.Groups[3].Value, CultureInfo.InvariantCulture); value3 = Math.Round(value3, 2); value4 = double.Parse(item.Groups[4].Value, CultureInfo.InvariantCulture); value4 = Math.Round(value4, 2); } catch (SystemException) { continue; } r.Name = value; r.X = value2; r.Y = value3; r.Z = value4; Log.Warn(r.X); r.Radius = 100; r.AllowLoading = true; r.AllowSaving = true; Plugin.Config.ZoneRestrictions.Add(r); GpsTextBox.Text = ""; Plugin.Config.RefreshModel(); return; } }