Пример #1
0
        /// <summary>
        /// This Method is a javascript callable method.
        /// </summary>
        /// <param name="e">A parameter from javascript</param>
        /// <param name="y">A callback to javascript</param>
        public void WebMethod2(XElement e, XElementAction y)
        {
            // Send something back from WebMethod2
            // http://do.jsc-solutions.net/Send-something-back-from-WebMethod2

            e.Element(@"Data").ReplaceAll(@"Data from the web server");
            // Send it to the caller.
            y(e);
        }
        /// <summary>
        /// This Method is a javascript callable method.
        /// </summary>
        /// <param name="e">A parameter from javascript</param>
        /// <param name="y">A callback to javascript</param>
        public void WebMethod2(XElement e, XElementAction y)
        {
            // Send something back from WebMethod2
            // http://do.jsc-solutions.net/Send-something-back-from-WebMethod2

            e.Element(@"Data").ReplaceAll(@"Data from the web server");
            // Send it to the caller.
            y(e);
        }
        /// <summary>
        /// This Method is a javascript callable method.
        /// </summary>
        /// <param name="e">A parameter from javascript. JSC supports string data type for all platforms.</param>
        /// <param name="y">A callback to javascript. In the future all platforms will allow Action&lt;XElementConvertable&gt; delegates.</param>
        public void WebMethod2(string e, XElementAction y)
        {
            var c = new WebClient();
            var s = c.DownloadString("http://api.justin.tv/api/stream/list.xml?category=entertainment&limit=9");

            // http://apiwiki.justin.tv/mediawiki/index.php/Stream/list

            // Send it back to the caller.
            y(XElement.Parse(s));
        }
        /// <summary>
        /// This Method is a javascript callable method.
        /// </summary>
        /// <param name="e">A parameter from javascript. JSC supports string data type for all platforms.</param>
        /// <param name="y">A callback to javascript. In the future all platforms will allow Action&lt;XElementConvertable&gt; delegates.</param>
        public void WebMethod2(string e, XElementAction y)
        {
            var c = new WebClient();
            var s = c.DownloadString("http://api.justin.tv/api/stream/list.xml?category=entertainment&limit=9");

            // http://apiwiki.justin.tv/mediawiki/index.php/Stream/list

            // Send it back to the caller.
            y(XElement.Parse(s));
        }