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


C# WebBrowser.AttachTo方法代码示例

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


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

示例1: InitializeContent

            // dynamic does not work in static yet?
            //static 
            void InitializeContent()
        {
            floorplan = new Floorplan();






            Action<string, double, double, double, double, double, double, double, double, double> buildCube =
                (colour, w, h, d, x, y, z, rx, ry, rz) =>
                {
                    new cube(colour, w, h, d, x, y, z, rx, ry, rz);

                };



            var zoom = 4;
            var zz = 60;
            var low = -500;

            var __index = 0;

            #region CreateFromFloorplan
            Action CreateFromFloorplan = delegate
            {
                foreach (var item in floorplan.Controls)
                {
                    (item as DeskCube).With(
                        f =>
                        {


                            var cubeheight = Math.Max(300, f.CubeHeight);
                            var z = 0;
                            var cubetex = "rgba(0,0,0,0.1)";

                            if (f.LeftWallSource != null)
                                if (f.LeftWallSource.StartsWith("#cloud"))
                                {
                                    z = low;
                                    cubetex = "";
                                }

                            if (f.WallSourceRight != null)
                                if (f.WallSourceRight.StartsWith("#cloud"))
                                {
                                    z = low;
                                    cubetex = "";
                                }

                            if (f.WallSourceTop != null)
                                if (f.WallSourceTop.StartsWith("#cloud"))
                                {
                                    z = low;
                                    cubetex = "";
                                }

                            if (f.WallSourceBottom != null)
                                if (f.WallSourceBottom.StartsWith("#cloud"))
                                {
                                    z = low;
                                    cubetex = "";
                                }

                            new cube(
                                cubetex,

                                 //w, h, d, x, y, z, rx, ry, rz
                                f.Width * zoom,

                                f.Height * zoom,

                                cubeheight / 4 * zoom,
                                //0,

                                -f.Right * zoom,

                                f.Top * zoom,

                                -(cubeheight / 4 * zoom) + zz - z * zoom,

                                //-250, 

                                0, 0, 0
                            ).With(
                                cube =>
                                {

                                    #region LoadContent
                                    Action<IHTMLDiv, string> LoadContent =
                                        (westContainer, src) =>
                                        {
                                            if (src == "#window" || src == "#webfiles")
                                            {
                                                var morespace = new IHTMLDiv().AttachTo(westContainer);

//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:Application.cs

示例2: 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)
        {
            // localStorage not available on android webview!
            //E/Web Console( 3751): Uncaught TypeError: Cannot set property '20130329 Hello world' of null at http://192.168.1.107:25459/view-source:32300


            FormStyler.AtFormCreated = FormStylerLikeFloat.LikeFloat;

            new GrayPatternBackground.HTML.Images.FromAssets.background().ToDocumentBackground();

            Console.WriteLine("serial 57770");

            "My Notez (loading...)".ToDocumentTitle();


            service.AtPendingActions +=
                count =>
                {
                    if (service.ServicePending.ElapsedMilliseconds > 500)
                    {
                        if (service.ServicePending.ElapsedMilliseconds > 4000)
                        {
                            "My Notez (offline)".ToDocumentTitle();
                            return;
                        }

                        "My Notez (pending)".ToDocumentTitle();
                        return;
                    }

                    "My Notez".ToDocumentTitle();
                };

            Native.window.onbeforeunload +=
                e =>
                {
                    if (service.ServicePending.IsRunning)
                        e.Text = "The changes made here have not yet made it to the server.";
                };

            var storage = new MyLocalStorage
            {

                AtRemove =
                    x => service.remove_LocalStorage(x),

                AtSetItem =
                    (key, value) =>
                    {
                        service.set_LocalStorage(key, value);
                    }
            };

            Console.WriteLine("Do we have localStorage? [2]");

            Native.window.localStorage.With(
                localStorage =>
                {
                    Console.WriteLine("This browser has localStorage. Lets sync with that. [2]");

                    for (uint i = 0; i < localStorage.length; i++)
                    {
                        var key = localStorage.key(i);
                        var value = localStorage[key];

                        storage[key] = value;
                    }

                    // jsc why aint ths working?
                    //storage.AtRemove += localStorage.removeItem;
                    storage.AtRemove += key => localStorage.removeItem(key);
                    storage.AtSetItem += (key, value) => { localStorage[key] = value; };

                }
            );

            #region done
            Action done = delegate
                {



                    var hh = new HorizontalSplit
                    {
                        Minimum = 0.05,
                        Maximum = 0.95,
                        Value = 0.4,
                    };


                    hh.Container.AttachToDocument();
                    hh.Container.style.position = IStyle.PositionEnum.absolute;
                    hh.Container.style.left = "0px";
                    hh.Container.style.top = "0px";
                    hh.Container.style.right = "0px";
                    hh.Container.style.bottom = "0px";
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:Application.cs

示例3: Application


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

                                       var wwbytes = new byte[scope.zbytes.Length / 4];
                                       var wi = 0;

                                       for (int i = 0; i < scope.zbytes.Length; i += 4)
                                       {
                                           // that be the red
                                           //wwbytes[wi] = scope.zbytes[i];

                                           // bet we need alpha
                                           wwbytes[wi] = scope.zbytes[i + 3];
                                           wi++;
                                       }



                                       return wwbytes;
                                   }
                               );
                               #endregion


                               var html = Encoding.UTF8.GetString(decodebytes);

                               ff.Text = "decoded " + new { html.Length, ContentBytesLength }.ToString();

                               //Console.WriteLine(new { html });


                               // um hide old data.
                               web.Hide();

                               var xweb = new WebBrowser { Dock = DockStyle.Fill };
                               xweb.AttachTo(ff);
                               xweb.DocumentText = html;
                               ff.Text = "!decoded " + new { html.Length, ContentBytesLength }.ToString();
                           };

                };
            #endregion


            Native.document.body.ondrop +=
                evt =>
                {
                    //if (evt.dataTransfer == null)
                    //    return;

                    var types = evt.dataTransfer.types == null ? 0 : evt.dataTransfer.types.Length;

                    var items = evt.dataTransfer.items == null ? 0u : evt.dataTransfer.items.length;
                    var files = evt.dataTransfer.files == null ? 0u : evt.dataTransfer.files.length;


                    Console.WriteLine("ondrop: " +
                        new
                        {

                            types,
                            items,
                            files
                        }
                    );


                    page.Header.style.color = JSColor.None;
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:67,代码来源:Application.cs

示例4: 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)
        {


            GrayScaleRule.InitializeGrayScaleFor("CLRForm");


            #region AddCLRForm
            Func<Form> AddCLRForm = delegate
            {
                var f = new Form();

                f.GetHTMLTarget().className = "CLRForm";

                f.Text = "CSS filter shader";

                #region WhileDragging
                Native.window.requestAnimationFrame +=
                    delegate
                    {
                        if (f.Capture)
                        {
                            f.GetHTMLTarget().className = "";
                            f.Text = "CSS filter shader (dragging)";
                        }
                        else
                        {
                            f.GetHTMLTarget().className = "CLRForm";
                            f.Text = "CSS filter shader";

                        }
                    };
                #endregion

                var i = new WebBrowser
                {
                    //Url = new Uri("/jsc"), 

                    Dock = DockStyle.Fill
                };

                i.AttachTo(f);

                f.Show();

                i.Navigate("/jsc");

                return f;
            };
            #endregion


            AddCLRForm().MoveBy(0, 0);

            FormStyler.AtFormCreated = FormStyler.LikeVisualStudioMetro;

            AddCLRForm().MoveBy(32, 16);

            FormStyler.AtFormCreated =
                s =>
                {

                    FormStyler.LikeVisualStudioMetro(s);

                    s.TargetOuterBorder.style.borderColor = ScriptCoreLib.JavaScript.Runtime.JSColor.Red;
                    s.Caption.style.backgroundColor = ScriptCoreLib.JavaScript.Runtime.JSColor.Red;
                    s.TargetOuterBorder.style.boxShadow = "rgba(255, 0, 0, 0.3) 0px 0px 6px 3px";
                };

            AddCLRForm().MoveBy(64, 32);

            //f.GotFocus +=
            //    delegate
            //    {
            //        f.Text = "GotFocus";
            //    };

            //f.LostFocus +=
            //  delegate
            //  {
            //      f.Text = "LostFocus";
            //  };

            @"Hello world".ToDocumentTitle();
            // Send data from JavaScript to the server tier
            service.WebMethod2(
                @"A string from JavaScript.",
                value => value.ToDocumentTitle()
            );
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:94,代码来源:Application.cs


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