示例#1
0
        private void toAtras(object sender, RoutedEventArgs e)
        {
            resultsWindow f = new resultsWindow(start, end, lat, longi);

            f.Show();
            Close();
        }
        private void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            var brush = new BrushConverter();

            longitudeTB.Background = (Brush)brush.ConvertFrom("#FFFFFF");
            latitudeTB.Background  = (Brush)brush.ConvertFrom("#FFFFFF");
            if (!startDate.SelectedDate.HasValue || !endDate.SelectedDate.HasValue)
            {
                startDate.Background = (Brush)brush.ConvertFrom("#FF3333");
                endDate.Background   = (Brush)brush.ConvertFrom("#FF3333");
                MessageBox.Show("Check your Start Date and End Date", "Warning", MessageBoxButton.OK);
            }
            else
            {
                startDate.Background = (Brush)brush.ConvertFrom("#FFFFFF");
                endDate.Background   = (Brush)brush.ConvertFrom("#FFFFFF");
                Double latitude  = 0.00;
                Double longitude = 0.00;
                try
                {
                    latitude  = Double.Parse(latitudeTB.Text.ToString());
                    longitude = Double.Parse(longitudeTB.Text.ToString());
                    resultsWindow window = new resultsWindow(startDate.SelectedDate.Value, endDate.SelectedDate.Value, latitude, longitude);
                    window.Show();
                    Close();
                }
                catch (Exception exc)
                {
                    longitudeTB.Background = (Brush)brush.ConvertFrom("#FF3333");
                    latitudeTB.Background  = (Brush)brush.ConvertFrom("#FF3333");
                    MessageBox.Show("Check your coordinates" + exc.ToString(), "Warning", MessageBoxButton.OK);
                }
            }
        }