當前位置: 首頁>>代碼示例>>C#>>正文


C# Foo.AttachTo方法代碼示例

本文整理匯總了C#中System.Foo.AttachTo方法的典型用法代碼示例。如果您正苦於以下問題:C# Foo.AttachTo方法的具體用法?C# Foo.AttachTo怎麽用?C# Foo.AttachTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Foo的用法示例。


在下文中一共展示了Foo.AttachTo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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)
        {
            //ms InternalFieldsFromTypeInitializer view-source:35337
            //13ms GetInternalFields load fromlocalstorage!  view-source:35337
            //22ms IHTMLImage <- IHTMLDiv view-source:35337
            //23ms Task<ISVGSVGElement> <- IHTMLDiv view-source:35337
            //31ms ContinueWhenAll { Length = 1, scheduler = [object Object], ManagedThreadId = 1 } view-source:35337
            //32ms IHTMLImage <- Task<ISVGSVGElement> view-source:35337
            //32ms enter contentImage view-source:35337
            //Application Cache Progress event (2 of 3) http://192.168.1.200:16552/view-source 192.168.1.200/:1
            //Application Cache Progress event (3 of 3)  192.168.1.200/:1
            //Application Cache Cached event 192.168.1.200/:1
            //133ms ContinueWhenAll_yield { scheduler = [object Object] } view-source:35337
            //134ms { clientWidth = 679, clientHeight = 249 } view-source:35337
            //170ms yield contentImage view-source:35337
            //61247ms enter contentImage view-source:35337
            //61248ms yield contentImage view-source:35337

            page.body.css.before.contentImage = new Foo().AsNode();
            page.body.css.before.style.position = IStyle.PositionEnum.absolute;
            page.body.css.before.style.bottom = "0";

            var s = new ISVGSVGElement
            {

            };

            var f = new ISVGForeignObject().AttachTo(s);

            var fdiv = new IHTMLDiv().AttachTo(f);

            fdiv.style.fontFamily = IStyle.FontFamilyEnum.Verdana;

            // we need to serialize styles now
            // svg wont have any default html css styles at all
            fdiv.style.fontSize = "12px";

            var div = new Foo();

            var hidden = new IHTMLDiv { }.AttachTo(Native.document.documentElement);
            hidden.style.position = [email protected];
            hidden.style.visibility = IStyle.VisibilityEnum.hidden;
            //hidden.style.display = IStyle.DisplayEnum.none;

            div.PageContainer.style.display = IStyle.DisplayEnum.inline_block;
            div.AttachTo(hidden);

            new IHTMLButton { "do " + new { div.PageContainer.clientWidth, div.PageContainer.clientHeight } }.AttachToDocument().WhenClicked(
               async button =>
               {

                   //div.querySelectorAll("img").WithEach(
                   div.ImageElements().WithEach(
                       q =>
                       {
                           q.src = q.toDataURL();

                       }
                   );

                   button.Orphanize();
                   s.setAttribute("width", div.PageContainer.clientWidth + 0);
                   s.setAttribute("height", div.PageContainer.clientHeight + 0);
                   div.AttachTo(fdiv);

                   // Uncaught SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
                   IHTMLImage i = s;
                   //Task<IHTMLCanvas> ic = s;

                   //var c = await ic;


                   //var ii = i.toDataURL();

                   page.body.css.after.contentImage = i;
                   page.body.css.after.style.position = IStyle.PositionEnum.absolute;
                   page.body.css.after.style.right = "0";

                   Console.WriteLine("cursor");
                   // cursor no longer appears?
                   Native.document.documentElement.style.cursorImage = i;
                   //Native.css.style.cursorImage = s;
                   Console.WriteLine("icon");
                   Native.document.icon = i;
               }
           );

        }
開發者ID:exaphaser,項目名稱:JSC-Cross-Compiler,代碼行數:92,代碼來源:Application.cs


注:本文中的System.Foo.AttachTo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。