Exemplo n.º 1
0
        /// <summary>
        /// The button to book the flight has been clicked.
        /// </summary>
        /// <param name="sender">The source object.</param>
        /// <param name="e">The event data.</param>
        private void BookFlight_Click(object sender, RoutedEventArgs e)
        {
            Airport  d  = (Airport)DepartureAirport.SelectedItem;
            Airport  a  = (Airport)ArrivalAirport.SelectedItem;
            DateTime dd = (DateTime)DepartureDate.SelectedDate;
            DateTime ad = (DateTime)ArrivalDate.SelectedDate;
            int      p  = (int)Passengers.Value;

            Uri travel = WebServiceHelper.CreateAirfareSearchUri(d, a, dd, ad, p);

#if SILVERLIGHT
            HtmlPage.Window.Navigate(travel, "_new");
#else
            System.Diagnostics.Process.Start(travel.ToString());
#endif
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles the Loaded event by initializing the control for live web
        /// service use if the stack is available.
        /// </summary>
        /// <param name="sender">The source object.</param>
        /// <param name="e">The event data.</param>
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            if (WebServiceHelper.CanMakeHttpRequests)
            {
                HostingWarning.Visibility = Visibility.Collapsed;
                Go.IsEnabled     = true;
                Search.IsEnabled = true;

                Search.Populating += Search_Populating;
                Action go = () => HtmlPage.Window.Navigate(WebServiceHelper.CreateWebSearchUri(Search.Text), "_blank");
                Search.KeyUp += (s, args) =>
                {
                    if (args.Key == System.Windows.Input.Key.Enter)
                    {
                        go();
                    }
                };
                Go.Click += (s, args) => go();
            }
        }
        /// <summary>
        ///     Handles the Loaded event by initializing the control for live web
        ///     service use if the stack is available.
        /// </summary>
        /// <param name="sender">The source object.</param>
        /// <param name="e">The event data.</param>
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            if (WebServiceHelper.CanMakeHttpRequests)
            {
                HostingWarning.Visibility = Visibility.Collapsed;
                Go.IsEnabled     = true;
                Search.IsEnabled = true;

                Search.Populating += Search_Populating;
#if SILVERLIGHT
                Action go = () => HtmlPage.Window.Navigate(WebServiceHelper.CreateWebSearchUri(Search.Text), "_blank");
#else
                Action go = () => Process.Start(WebServiceHelper.CreateWebSearchUri(Search.Text).ToString());
#endif
                Search.KeyUp += (s, args) =>
                {
                    if (args.Key == Key.Enter)
                    {
                        go();
                    }
                };
                Go.Click += (s, args) => go();
            }
        }