Exemplo n.º 1
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();
            }
        }