protected void OnButtonInsertFromBufferClicked(object sender, EventArgs e) { bool error = true; string booferCoordinates = clipboard.WaitForText(); string[] coordinates = booferCoordinates?.Split(','); if (coordinates?.Length == 2) { bool goodLat = decimal.TryParse(coordinates[0].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out decimal lat); bool goodLon = decimal.TryParse(coordinates[1].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out decimal lng); SetCoordinates(lat, lng); if (goodLat && goodLon) { deliverypriceview.DeliveryPrice = DeliveryPriceCalculator.Calculate(latitude, longitude, yspinBottles.ValueAsInt); error = false; } } if (error) { MessageDialogHelper.RunErrorDialog( "Буфер обмена не содержит координат или содержит неправильные координаты"); } }
void EntryBuilding_Changed(object sender, EventArgs e) { if (entryBuilding.FiasCompletion.HasValue && entryBuilding.FiasCompletion.Value) { entryBuilding.GetCoordinates(out decimal? lng, out decimal? lat); SetCoordinates(lat, lng); deliverypriceview.DeliveryPrice = DeliveryPriceCalculator.Calculate(latitude, longitude, yspinBottles.ValueAsInt); } }
public void Refresh() { DeliveryPoint = (InfoProvider as IDeliveryPointInfoProvider)?.DeliveryPoint; if (DeliveryPoint == null || string.IsNullOrWhiteSpace(DeliveryPoint?.City)) { return; } var deliveryPrice = DeliveryPriceCalculator.Calculate(DeliveryPoint); labelError.Visible = deliveryPrice.HasError; labelError.Markup = $"<span foreground=\"red\"><b>{deliveryPrice.ErrorMessage}</b></span>"; deliverypriceview.Visible = !deliveryPrice.HasError; deliverypriceview.DeliveryPrice = deliveryPrice; }
public DeliveryPriceDlg(DeliveryPoint deliveryPoint) : this() { SetCoordinates(deliveryPoint.Latitude, deliveryPoint.Longitude); deliverypriceview.DeliveryPrice = DeliveryPriceCalculator.Calculate(latitude, longitude, yspinBottles.ValueAsInt); }
protected void OnYspinBottlesValueChanged(object sender, EventArgs e) { deliverypriceview.DeliveryPrice = DeliveryPriceCalculator.Calculate(latitude, longitude, yspinBottles.ValueAsInt); }