Exemplo n.º 1
0
        private async void dgOrders_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (dgOrders.SelectedIndex >= 0)
            {
                var    order    = (Order)dgOrders.SelectedItem;
                double distance = 0;

                try
                {
                    distance = GetDistanceBetweenCities(order.From, order.To);
                    CalculateShowPriceGui(distance);
                }
                catch (Exception)
                {
                    DistanceErrorWindow.Show();
                    DistanceErrorWindow.Closed += (o, args) =>
                    {
                        if (DistanceErrorWindow.DialogResult != null && DistanceErrorWindow.DialogResult.Value)
                        {
                            distance = double.Parse(tbdistance.Text);
                            CalculateShowPriceGui(distance);
                        }
                    };
                }
            }
        }
Exemplo n.º 2
0
 private void btnDistanceOk_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(tbdistance.Text))
     {
         DistanceErrorWindow.DialogResult = true;
         DistanceErrorWindow.Close();
     }
 }