Пример #1
0
        public ScriptableTest()
        {
            plugin  = HtmlPage.Plugin;
            window  = HtmlPage.Window;
            content = plugin.GetProperty("Content") as ScriptObject;

            //bool ispopupon = HtmlPage.IsPopupWindowAllowed;
            //HtmlWindow popup = HtmlPage.PopupWindow (new Uri ("about:blank"), "_blank", new HtmlPopupWindowOptions ());
            calc           = new Calculator();
            scriptable     = new Scriptable();
            scriptabletype = new ScriptableType();

            HtmlPage.RegisterScriptableObject("calc", calc);
            HtmlPage.RegisterScriptableObject("scriptable", scriptable);
            HtmlPage.RegisterScriptableObject("scriptabletype", scriptabletype);
            HtmlPage.RegisterCreateableType("createable", typeof(CreateableType));

            if (Environment.OSVersion.Platform == PlatformID.Unix)
            {
                strplugin = "document.getElementById('silverlight')";
            }
            else
            {
                strplugin = "document.getElementById('silverlightControlHost').getElementsByTagName('object')[0]";
            }
        }
Пример #2
0
		public ScriptableTest ()
		{
			plugin = HtmlPage.Plugin;
			window = HtmlPage.Window;
			content = plugin.GetProperty ("Content") as ScriptObject;

			//bool ispopupon = HtmlPage.IsPopupWindowAllowed;
			//HtmlWindow popup = HtmlPage.PopupWindow (new Uri ("about:blank"), "_blank", new HtmlPopupWindowOptions ());
			calc = new Calculator ();
			scriptable = new Scriptable ();
			scriptabletype = new ScriptableType ();

			HtmlPage.RegisterScriptableObject ("calc", calc);
			HtmlPage.RegisterScriptableObject ("scriptable", scriptable);
			HtmlPage.RegisterScriptableObject ("scriptabletype", scriptabletype);
			HtmlPage.RegisterCreateableType ("createable", typeof (CreateableType));

			if (Environment.OSVersion.Platform == PlatformID.Unix)
				strplugin = "document.getElementById('silverlight')";
			else
				strplugin = "document.getElementById('silverlightControlHost').getElementsByTagName('object')[0]";
		}