예제 #1
0
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            var browser = new Microsoft.Phone.Controls.WebBrowser();

            browser.IsScriptEnabled = true;
            browser.Visibility      = Visibility.Collapsed;
            browser.Loaded         += (asender, args) => browser.NavigateToString(getUserAgentHtml);
            browser.ScriptNotify   += (asender, args) =>
            {
                string userAgent = args.Value;
                LayoutRoot.Children.Remove(browser);
                this._userAgent = userAgent;
            };
            LayoutRoot.Children.Add(browser);
        }
            public static void GetUserAgent(Panel rootElement, Action <string> callback)
            {
                var browser = new Microsoft.Phone.Controls.WebBrowser();

                browser.IsScriptEnabled = true;
                browser.Visibility      = Visibility.Collapsed;
                browser.Loaded         += (sender, args) => browser.NavigateToString(Html);
                browser.ScriptNotify   += (sender, args) =>
                {
                    string userAgent = args.Value;
                    rootElement.Children.Remove(browser);
                    callback(userAgent);
                };
                rootElement.Children.Add(browser);
            }
예제 #3
0
 private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
 {
     var browser = new Microsoft.Phone.Controls.WebBrowser();
     browser.IsScriptEnabled = true;
     browser.Visibility = Visibility.Collapsed;
     browser.Loaded += (asender, args) => browser.NavigateToString(getUserAgentHtml);
     browser.ScriptNotify += (asender, args) =>
     {
         string userAgent = args.Value;
         LayoutRoot.Children.Remove(browser);
         this._userAgent = userAgent;
     };
     LayoutRoot.Children.Add(browser);
 }