// Make sure you run this on a UI thread
        public static void CheckFlash(Action flashInstalledCallback, Action flashNotInstalledCallback, Action errorCallback)
        {
            _flashInstalledCallback = flashInstalledCallback;
            _flashNotInstalledCallback = flashNotInstalledCallback;
            _errorCallback = errorCallback;

            // Read in swfobject.  Included locally so this runs without a network connection.
            System.IO.Stream s = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("AwesomiumCheckFlashChecker.Resources.swfobject.js");
            System.IO.StreamReader sr = new System.IO.StreamReader(s);
            string swfObjectCode = sr.ReadToEnd();

            string html = "";
            html += "<div id='flashstatus'></div>";
            //html += "<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js'></script>";
            html += "<script type='text/javascript'>" + swfObjectCode + "</script>";
            html += "<script type='text/javascript'>";
            html += "document.getElementById('flashstatus').innerHTML = swfobject.hasFlashPlayerVersion('1') ? 'FLASH INSTALLED' : 'NO FLASH';";
            html += "</script>";

            try
            {
                _checkFlashSession = Awesomium.Core.WebCore.CreateWebSession(new Awesomium.Core.WebPreferences());
                _webView = Awesomium.Core.WebCore.CreateWebView(100, 100, _checkFlashSession, Awesomium.Core.WebViewType.Offscreen);
                _webView.DocumentReady += new Awesomium.Core.UrlEventHandler(webView_DocumentReady);

                bool success = _webView.LoadHTML(html);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Write(ex);
            }
        }
Пример #2
0
        // Make sure you run this on a UI thread
        public static void CheckFlash(Action flashInstalledCallback, Action flashNotInstalledCallback, Action errorCallback)
        {
            _flashInstalledCallback    = flashInstalledCallback;
            _flashNotInstalledCallback = flashNotInstalledCallback;
            _errorCallback             = errorCallback;

            // Read in swfobject.  Included locally so this runs without a network connection.
            System.IO.Stream       s  = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("AwesomiumCheckFlashChecker.Resources.swfobject.js");
            System.IO.StreamReader sr = new System.IO.StreamReader(s);
            string swfObjectCode      = sr.ReadToEnd();

            string html = "";

            html += "<div id='flashstatus'></div>";
            //html += "<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js'></script>";
            html += "<script type='text/javascript'>" + swfObjectCode + "</script>";
            html += "<script type='text/javascript'>";
            html += "document.getElementById('flashstatus').innerHTML = swfobject.hasFlashPlayerVersion('1') ? 'FLASH INSTALLED' : 'NO FLASH';";
            html += "</script>";

            try
            {
                _checkFlashSession      = Awesomium.Core.WebCore.CreateWebSession(new Awesomium.Core.WebPreferences());
                _webView                = Awesomium.Core.WebCore.CreateWebView(100, 100, _checkFlashSession, Awesomium.Core.WebViewType.Offscreen);
                _webView.DocumentReady += new Awesomium.Core.UrlEventHandler(webView_DocumentReady);

                bool success = _webView.LoadHTML(html);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Write(ex);
            }
        }