Example #1
0
        static public IActiveX InternalConstructor(params string[] e)
        {
            IActiveX r = null;

            foreach (string z in e)
            {
                r = (IActiveX)TryCreate(z);

                if (r != null)
                {
                    break;
                }
            }

            return(r);
        }
        internal static GoogleGearsFactory InternalConstructor()
        {
            throw new NotImplementedException();
            // something causes a rewrite error in here. what is it.

            object r = null;

            var error = "Google Gears is not installed or not supported for current browser!";

            // Mozilla
            try
            {
                r = IFunction.Of("GearsFactory").CreateType();
            }
            catch
            {
            }

            // IE
            if (r == null)
            {
                try
                {
                    r = new ScriptCoreLib.JavaScript.DOM.IActiveX("Gears.Factory");
                }
                catch
                {
                }
            }

            // Safari
            if (r == null)
            {
                try
                {
                    var s = new IFunction("return !!navigator.mimeTypes['application/x-googlegears']").apply(null);

                    //                  if ((typeof navigator.mimeTypes != 'undefined')
                    //     && navigator.mimeTypes["application/x-googlegears"]) {
                    //  factory = document.createElement("object");
                    //  factory.style.display = "none";
                    //  factory.width = 0;
                    //  factory.height = 0;
                    //  factory.type = "application/x-googlegears";
                    //  document.documentElement.appendChild(factory);
                    //}


                    error = "Google Gears for safari is not yet supported (June 2007); plugin installed: " + s;
                }
                catch
                {
                }
            }

            if (r == null)
            {
                throw new System.Exception(error);
            }

            return((GoogleGearsFactory)r);

            //// Firefox
            //if (typeof GearsFactory != 'undefined') {
            //  factory = new GearsFactory();
            //} else {
            //  // IE
            //  try {
            //    factory = new ActiveXObject('Gears.Factory');
            //  } catch (e) {
            //    // Safari
            //    if (navigator.mimeTypes["application/x-googlegears"]) {
            //      factory = document.createElement("object");
            //      factory.style.display = "none";
            //      factory.width = 0;
            //      factory.height = 0;
            //      factory.type = "application/x-googlegears";
            //      document.documentElement.appendChild(factory);
            //    }
            //  }
            //}
        }