Beispiel #1
0
        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(
                    "Буфер обмена не содержит координат или содержит неправильные координаты");
            }
        }
Beispiel #2
0
 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);
     }
 }
Beispiel #3
0
        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;
        }
Beispiel #4
0
 public DeliveryPriceDlg(DeliveryPoint deliveryPoint) : this()
 {
     SetCoordinates(deliveryPoint.Latitude, deliveryPoint.Longitude);
     deliverypriceview.DeliveryPrice = DeliveryPriceCalculator.Calculate(latitude, longitude, yspinBottles.ValueAsInt);
 }
Beispiel #5
0
 protected void OnYspinBottlesValueChanged(object sender, EventArgs e)
 {
     deliverypriceview.DeliveryPrice = DeliveryPriceCalculator.Calculate(latitude, longitude, yspinBottles.ValueAsInt);
 }