当前位置: 首页>>代码示例>>C#>>正文


C# ScriptCoreLib.WithEach方法代码示例

本文整理汇总了C#中ScriptCoreLib.WithEach方法的典型用法代码示例。如果您正苦于以下问题:C# ScriptCoreLib.WithEach方法的具体用法?C# ScriptCoreLib.WithEach怎么用?C# ScriptCoreLib.WithEach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ScriptCoreLib的用法示例。


在下文中一共展示了ScriptCoreLib.WithEach方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Application


//.........这里部分代码省略.........

                            var Launch = new IHTMLButton { innerText = "Launch" }.AttachTo(div).WhenClicked(
                                    btn =>
                                    {
                                        // http://help.adobe.com/en_US/air/build/WSfffb011ac560372f-5d0f4f25128cc9cd0cb-7ffd.html

                                        service.Launch(packageName, name);
                                    }
                                );


                            var LaunchFloat = new IHTMLButton { innerText = "Launch Float" }.AttachTo(div).WhenClicked(
                                 btn =>
                                 {

                                     service.Launch(packageName, name,
                                         ExtraKey: "Float",
                                         ExtraValue: "Float"
                                     );
                                 }
                             );

                            // var LaunchWebService = new IHTMLButton { innerText = "Launch WebService" }.AttachTo(div).WhenClicked(
                            //    btn =>
                            //    {

                            //        //service.Launch(packageName, name);
                            //    }
                            //);


                            var item = new
                            {
                                div,
                                packageName,
                                name,
                                Remove,
                                Launch
                            };


                            items.Add(item);

                            //https://play.google.com/store/apps/details?id=com.abstractatech.battery

                            new IHTMLAnchor { href = "https://play.google.com/store/apps/details?id=" + packageName, innerText = name }.AttachTo(div);
                            #endregion

                        }
                    );

                    items.WithEach(
                                   item =>
                                   {
                                       if (a.Contains(item.packageName))
                                           return;

                                       item.div.style.color = "red";

                                       item.Launch.disabled = true;
                                       item.Remove.disabled = true;
                                   }
                               );

                    // remove others!
                };

            queryIntentActivities();

            new Timer(
                delegate
                {
                    items.WithEach(
                        item =>
                        {
                            if (string.IsNullOrEmpty(page.search.value))
                            {
                                item.div.Show();
                            }
                            else
                            {
                                if (item.packageName.Contains(page.search.value))
                                {
                                    item.div.Show();
                                }
                                else
                                {
                                    item.div.Hide();
                                }
                            }

                        }
                    );

                    queryIntentActivities();
                }
            ).StartInterval(2000);


        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:Application.cs

示例2: Application


//.........这里部分代码省略.........
                at_mouseup();
                internal_mouseup();
            };



            #region exit_MultiMouseMode
            Action internal_exit_MultiMouseMode = delegate
            {
                svgcursor1.fill(0, 0, 0);
                vcursor.fill(0, 0, 0);

                con.Opacity = 0.9;
                page.content.style.Opacity = 0.3;
                page.content.style.zIndex = 0;

                page.content.style.backgroundColor = "rgba(0, 148, 155, 1)";
                Native.Document.body.style.backgroundColor = "black";

                page.content.style.With(
                    (dynamic s) =>
                    {
                        s.webkitFilter = "blur(3px)";
                    }
                );

                page.info.style.With(
                    (dynamic s) =>
                    {
                        s.webkitFilter = "";
                    }
                );

                Shadows.WithEach(
                   f =>
                       f.GetHTMLTarget().style.With(
                           (dynamic s) =>
                           {
                               s.webkitFilter = "";
                           }
                       )
                 );


                fs.FormsByOwnership().WithEach(
                 f =>
                     f.GetHTMLTarget().style.With(
                         (dynamic s) =>
                         {
                             s.webkitFilter = "";

                         }
                     )
            );


                fvs.OwnedForms.WithEach(
                    k =>
                    {
                        k.GetHTMLTarget().style.display = IStyle.DisplayEnum.block;
                    }
                );



开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:63,代码来源:Application.cs

示例3: Application

        /// <summary>
        /// This is a javascript application.
        /// </summary>
        /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
        public Application(IApp page)
        {
            // Z:\jsc.svn\examples\javascript\io\DropLESTToDisplay\DropLESTToDisplay\Application.cs
            // http://xgis.maaamet.ee/xGIS/XGis?app_id=UU82&user_id=at&bbox=529464.185181536,6581178.67615528,549196.965601648,6593508.79911233&LANG=1
            // http://www.maaamet.ee/rr/geo-lest/files/geo-lest_function_vba.txt

            // can we have a list of cities on ?

            var Helsinki = new { x = 6671069.664199971, y = 552396.6626611819 };
            var Tallinn = new { x = 6589000.065127177, y = 542791.0230507818 };
            var Haapsalu = new { x = 6533398.0, y = 480832.0 };
            var Narva = new { x = 6589333.658324879, y = 737954.1228769943 };
            var Tartu = new { x = 6474047.4766877275, y = 659622.4604005406 };



            // alright lets do this.

            new { }.With(
              async delegate
              {
                  await google.maps.api;


                  var div = new IHTMLDiv
                  {
                  }.AttachToDocument();

                  div.style.border = "1px dashed red";
                  div.style.height = "300px";
                  div.style.left = "0px";
                  div.style.right = "0px";

                  // Z:\jsc.svn\examples\javascript\io\DropLESTToDisplay\DropLESTToDisplay\Application.cs
                  var map = new google.maps.Map(div,
                      new
                      {

                          center = new { lat = 59.4329527, lng = 24.7023564 },
                          zoom = 6.0
                      }
                  );

                  var all = new[] { Helsinki, Tallinn, Haapsalu, Narva, Tartu };

                  all.WithEach(
                       data =>
                       {
                           var marker = new google.maps.Marker(
                              new
                              {
                                  position = new
                                  {
                                      lat = LEST97.lest_function_vba.lest_geo(data.x, data.y, 0),
                                      lng = LEST97.lest_function_vba.lest_geo(data.x, data.y, 1)
                                  },
                                  //label = "T",
                                  //title = "Tallinn",
                                  map
                              }
                           );
                       }
                     );





                  new IHTMLPre
                  {
                      () =>
                          new
                          {
                              map.getCenter().lat,
                              map.getCenter().lng,

                              x = LEST97.lest_function_vba.geo_lest( map.getCenter().lat, map.getCenter().lng, 0),
                              y = LEST97.lest_function_vba.geo_lest( map.getCenter().lat, map.getCenter().lng, 1),
                          }
                  }.AttachToDocument();


                  // Cannot read property 'getSouthWest' of undefined
                  new IHTMLPre
                  {
                      //  rectangle.addListener('bounds_changed', showNewRect);

                      delegate
                      {

                          if (map.getBounds() == null)
                          {
                              return "n/a";
                          }

                          var getSouthWest_lat = map.getBounds().getSouthWest().lat;
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:Application.cs

示例4: Handler

        public void Handler(WebServiceHandler h)
        {
            var HostUri = new
            {
                Host = h.Context.Request.Headers["Host"].TakeUntilIfAny(":"),
                Port = h.Context.Request.Headers["Host"].SkipUntilIfAny(":")
            };

            if (HostUri.Port == "")
                HostUri = new { HostUri.Host, Port = "80" };

            #region Authorization
            var Authorization = h.Context.Request.Headers["Authorization"];

            var AuthorizationLiteralEncoded = Authorization.SkipUntilOrEmpty("Basic ");
            var AuthorizationLiteral = Encoding.ASCII.GetString(
                Convert.FromBase64String(AuthorizationLiteralEncoded)
            );

            var AuthorizationLiteralCredentials = new
            {
                user = AuthorizationLiteral.TakeUntilOrEmpty(":"),
                password = AuthorizationLiteral.SkipUntilOrEmpty(":"),
            };


            #endregion


#if DEBUG

            Console.WriteLine();
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine(h.Context.Request.HttpMethod + " " + h.Context.Request.Path);
            Console.ForegroundColor = ConsoleColor.Red;

            if (!string.IsNullOrEmpty(AuthorizationLiteralCredentials.user))
            {
                Console.WriteLine(new { AuthorizationLiteralCredentials }.ToString());
            }
            Console.ForegroundColor = ConsoleColor.Green;

            h.Context.Request.Headers.AllKeys.WithEach(
                k => Console.WriteLine(k + ": " + h.Context.Request.Headers[k])
            );

            h.Context.Request.Form.AllKeys.WithEach(
              k => Console.WriteLine(k + ": " + h.Context.Request.Form[k])
          );
#endif

            #region WWWAuthenticate
            Action WWWAuthenticate = delegate
            {
#if DEBUG
                Console.ForegroundColor = ConsoleColor.Magenta;
                Console.WriteLine("Hey, who are you?");
                Console.ForegroundColor = ConsoleColor.Green;
#endif
                h.Context.Response.StatusCode = 401;
                h.Context.Response.AddHeader(
                    "WWW-Authenticate",
                    "Basic realm=\"[email protected]\""
                );
                h.CompleteRequest();
            };
            #endregion

            #region /nuget
            if (h.Context.Request.Path == "/nuget")
            {

                if (string.IsNullOrEmpty(AuthorizationLiteralCredentials.user))
                {
                    WWWAuthenticate();
                    return;
                }


                h.Context.Response.ContentType = "application/xml";
                h.Context.Response.Write(@"

<service xmlns:atom='http://www.w3.org/2005/Atom' xmlns:app='http://www.w3.org/2007/app' xmlns='http://www.w3.org/2007/app' xml:base='http://localhost:59019/nuget/'>
<workspace>
<atom:title>Default</atom:title>
<collection href='Packages'>
<atom:title>Packages</atom:title>
</collection>
</workspace>
</service>
                ".Replace("localhost:59019", HostUri.Host + ":" + HostUri.Port));
                h.CompleteRequest();

                return;
            }
            #endregion

            #region /nuget/$metadata
            if (h.Context.Request.Path == "/nuget/$metadata")
            {
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ApplicationWebService.cs


注:本文中的ScriptCoreLib.WithEach方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。