Ejemplo n.º 1
0
        /// <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)
        {
            FormStyler.AtFormCreated =
             s =>
             {
                 s.Context.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

                 //var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDrag().AttachTo(s.Context.GetHTMLTarget());
                 var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDragWithShadow().AttachTo(s.Context.GetHTMLTarget());
             };


            #region ChromeTCPServer
            dynamic self = Native.self;
            dynamic self_chrome = self.chrome;
            object self_chrome_socket = self_chrome.socket;

            if (self_chrome_socket != null)
            {
                chrome.Notification.DefaultTitle = "AvalonUgh";
                chrome.Notification.DefaultIconUrl = new HTML.Images.FromAssets.Preview().src;



                ChromeTCPServer.TheServerWithStyledForm.Invoke(AppSource.Text,
                    DefaultWidth: ApplicationSprite.DefaultWidth,
                    DefaultHeight: ApplicationSprite.DefaultHeight,
                    AtFormCreated: FormStyler.AtFormCreated

                );

                return;
            }
            #endregion


            //new gong().AttachToDocument().play();
            new ThreeDStuff.js.Tycoon4();

            //AndroidFlashTreasureHunt.IsometricView.ApplicationContent.InitializeContent(
            //    delegate
            //    {
            InitializeContent();
            //    }
            //);



        }
Ejemplo n.º 2
0
        /// <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)
        {
#if FCHROME
            FormStyler.AtFormCreated =
                s =>
            {
                s.Context.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

                //var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDrag().AttachTo(s.Context.GetHTMLTarget());
                var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDragWithShadow().AttachTo(s.Context.GetHTMLTarget());
            };


            #region ChromeTCPServer
            dynamic self               = Native.self;
            dynamic self_chrome        = self.chrome;
            object  self_chrome_socket = self_chrome.socket;

            if (self_chrome_socket != null)
            {
                chrome.Notification.DefaultIconUrl = new HTML.Images.FromAssets.Preview().src;
                //chrome.Notification.DefaultTitle = "FlashTowerDefense for Galaxy Note";
                chrome.Notification.DefaultTitle = "FlashTowerDefense";


                ChromeTCPServer.TheServerWithStyledForm.Invoke(
                    AppSource.Text,
                    ApplicationSprite.DefaultWidth,

                    // no border. should be calculate automatically.
                    ApplicationSprite.DefaultHeight - 30,
                    FormStyler.AtFormCreated
                    );

                return;
            }
            #endregion
#endif



            // Initialize MySprite1
            new ApplicationSprite().AttachSpriteToDocument();
        }
Ejemplo n.º 3
0
        /// <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(IDefault page)
        {
            FormStyler.AtFormCreated =
            s =>
            {
                s.Context.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

                //var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDrag().AttachTo(s.Context.GetHTMLTarget());
                var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDragWithShadow().AttachTo(s.Context.GetHTMLTarget());
            };

            #region ChromeTCPServer
            dynamic self = Native.self;
            dynamic self_chrome = self.chrome;
            object self_chrome_socket = self_chrome.socket;

            if (self_chrome_socket != null)
            {
                Console.WriteLine("FlashHeatZeeker shall run as a chrome app as server");

                chrome.Notification.DefaultTitle = "AvalonPipeMania";
                //chrome.Notification.DefaultIconUrl = new HTML.Images.FromAssets.Preview().src;

                ChromeTCPServer.TheServerWithStyledForm.Invoke(
                    DefaultSource.Text,
                    AtFormCreated: FormStyler.AtFormCreated
                );

                return;
            }
            #endregion

            ApplicationSprite sprite = new ApplicationSprite();
            sprite.AutoSizeSpriteTo(page.ContentSize);
            sprite.AttachSpriteTo(page.Content);
        }
Ejemplo n.º 4
0
        // https://chrome.google.com/webstore/developer/dashboard/

        //FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Pages.TexturesImages
        //rewriting... done
        //2584:02:01 RewriteToAssembly error: System.ArgumentException: The unmanaged Version information is too large to persist.
        //   at System.Reflection.Emit.AssemblyBuilder.CreateVersionInfoResource(
        // String filename, String title, String iconFilename, String description, St
        // jsc how much description are you merging?


        // crx
        // https://chrome.google.com/webstore/detail/operation-heat-zeeker/iiabebggdceojiejhopnopmbkgandhha?hl=et&utm_source=chrome-ntp-launcher
        // use non chrome to download without install
        // http://clients2.google.com/service/update2/crx?response=redirect&x=id%3Diiabebggdceojiejhopnopmbkgandhha%26uc%26lang%3Den-US&prod=chrome
        // Download interrupted
        // means servers are not yet in sync, wait some
        // pbaaphpbkehboammnlcihpemkkimdfgo
        // http://clients2.google.com/service/update2/crx?response=redirect&x=id%3Dpbaaphpbkehboammnlcihpemkkimdfgo%26uc%26lang%3Den-US&prod=chrome
        // error-unknownApplication
        // Error 404

        //public readonly ApplicationWebService service = new ApplicationWebService();

        // https://groups.google.com/a/chromium.org/forum/#!msg/chromium-extensions/3sXvdfb5qk8/iMteKuIawcUJ
        // An error occurred: Failed to process your item.
        // background subsection of app section is not supported.

        // * New packaged apps are currently able to be searched and browsed in the Chrome Web Store by Windows and Chrome OS users on Chrome's developer channel. Users on other OSs and Chrome channels can view and install the app via a direct link.


        //Error	13	The type 'FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Pages.IApp' exists in both
        //    'x:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\packages\Chrome.Web.Server.1.0.0.0\lib\Chrome Web Server.dll' and
        //        'x:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\FlashHeatZeeker.PlayerIOIntegrationBeta2\bin\staging.AssetsLibrary\FlashHeatZeeker.PlayerIOIntegrationBeta2.AssetsLibrary.dll'	X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\FlashHeatZeeker.PlayerIOIntegrationBeta2\Application.cs	67	28	FlashHeatZeeker.PlayerIOIntegrationBeta2
        //Error	14	The type 'FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Images.FromAssets.Preview' exists in both 'X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\FlashHeatZeeker.PlayerIOIntegrationBeta2\bin\staging.AssetsLibrary\FlashHeatZeeker.PlayerIOIntegrationBeta2.AssetsLibrary.dll' and 'X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\packages\Chrome.Web.Server.1.0.0.0\lib\Chrome Web Server.dll'	X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\FlashHeatZeeker.PlayerIOIntegrationBeta2\Application.cs	123	81	FlashHeatZeeker.PlayerIOIntegrationBeta2
        //Error	15	The type 'FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Pages.AppSource' exists in both 'X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\FlashHeatZeeker.PlayerIOIntegrationBeta2\bin\staging.AssetsLibrary\FlashHeatZeeker.PlayerIOIntegrationBeta2.AssetsLibrary.dll' and 'X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\packages\Chrome.Web.Server.1.0.0.0\lib\Chrome Web Server.dll'	X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\FlashHeatZeeker.PlayerIOIntegrationBeta2\Application.cs	126	21	FlashHeatZeeker.PlayerIOIntegrationBeta2


        /// <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(xassets::FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Pages.IXApp page)
        {
            //method:Void .ctor(FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Pages.IXApp), ex = System.TypeLoadException: Could not load type 'ChromeTCPServer.TheServer' from assembly 'Chrome Web Server, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

            // https://code.google.com/p/chromium/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&groupby=&sort=&id=313673
            // https://code.google.com/p/chromium/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&groupby=&sort=&id=317352&thanks=317352&ts=1384094600

            // current way
            //FormStyler.AtFormCreated = s =>
            //{
            //    // X:\jsc.svn\examples\javascript\IsometricTycoonViewWithToolbar\IsometricTycoonViewWithToolbar\Application.cs
            //    // X:\jsc.internal.svn\core\com.abstractatech.web\com.abstractatech.web\Domains\discover.xavalon.net\discover_xavalon_net.cs

            //    // browser popup will use this color
            //    ((__Form)s.Context).HTMLTargetContainerRef.style.backgroundColor = JSColor.FromRGB(154, 108, 70);

            //    s.Caption.style.backgroundColor = JSColor.FromRGB(154, 108, 70);
            //    s.TargetOuterBorder.style.boxShadow = "rgba(154, 108, 70, 0.3) 0px 0px 6px 3px";
            //    s.TargetOuterBorder.style.borderColor = JSColor.FromRGB(154, 108, 70);

            //    s.TargetInnerBorder.style.borderWidth = "0px";

            //    s.CloseButton.style.color = JSColor.White;
            //    s.CloseButton.style.backgroundColor = JSColor.None;
            //    s.CloseButton.style.borderWidth = "0px";
            //    s.CloseButtonContent.style.borderWidth = "0px";

            //    s.TargetResizerPadding.style.left = "0px";
            //    s.TargetResizerPadding.style.top = "0px";
            //    s.TargetResizerPadding.style.right = "0px";
            //    s.TargetResizerPadding.style.bottom = "0px";

            //};


            // new way

            FormStyler.AtFormCreated =
                s =>
            {
                s.Context.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

                //var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDrag().AttachTo(s.Context.GetHTMLTarget());
                var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDragWithShadow().AttachTo(s.Context.GetHTMLTarget());



                s.Context.GetHTMLTarget().style.backgroundColor = "#A26D41";
            };



            #region ChromeTCPServer
            dynamic self               = Native.self;
            dynamic self_chrome        = self.chrome;
            object  self_chrome_socket = self_chrome.socket;

            if (self_chrome_socket != null)
            {
                Console.WriteLine("FlashHeatZeeker shall run as a chrome app as server");

                chrome.Notification.DefaultTitle   = "Operation «Heat Zeeker»";
                chrome.Notification.DefaultIconUrl = new xassets::FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Images.FromAssets.Preview().src;

                ChromeTCPServer.TheServerWithStyledForm.Invoke(
                    xassets::FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Pages.XAppSource.Text,
                    AtFormCreated: FormStyler.AtFormCreated

                    //AtFormConstructor:
                    //    f =>
                    //    {
                    //        //arg[0] is typeof System.Int32
                    //        //script: error JSC1000: No implementation found for this native method, please implement [static System.Drawing.Color.FromArgb(System.Int32)]

                    //        // X:\jsc.svn\examples\javascript\forms\Test\TestFromArgb\TestFromArgb\ApplicationControl.cs

                    //        f.BackColor = System.Drawing.Color.FromArgb(0xA26D41);
                    //    }
                    );

                return;
            }
            #endregion



            // Your item is in the process of being published and may take up to 60 minutes to appear in the Chrome Web Store.
            // https://chrome.google.com/webstore/detail/cpcgbahhjcobocclaolehaffhpfonofe/publish-delayed



            var sprite = new ApplicationSprite();



            sprite.AttachSpriteToDocument().With(
                embed =>
            {
                // show thumbnail
                // or click to enable plugin?
                embed.style.SetLocation(0, 0);
                //embed.style.SetSize(Native.window.Width, 96);
                embed.style.SetSize(Native.window.Width, Native.window.Height);

                //embed.style.transition = "height 200ms linear";

                // after preloader or can we chime in before too?
                sprite.WhenReady(
                    async delegate
                {
                    embed.style.SetSize(Native.window.Width, Native.window.Height);


                    //embed.style.transition = "";


                    Native.window.onresize +=
                        delegate
                    {
                        embed.style.SetSize(Native.window.Width, Native.window.Height);
                    };

                    // this will not work if offline or lan only
                    // chrome webview needs to allow new window
                    // in order to log in. { loginstatus = unknown }

#if FFACEBOOK
                    var user = await FaceBook.API.Spy.GetCurrentUser();

                    new TitleElement {
                    }.AttachToDocument().Container.innerText = user.name;
#endif


                    //new IHTMLDiv { innerText = user.name }.AttachToDocument().style.SetLocation(64, 8);
                }
                    );
            }
                );

            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2013/201310/20131029-nuget
            // wont work yet

            //IStyleSheet.all["*"].style.setProperty(
            //    //"cursor", "url('" + new _3dgarro().src + "'), auto", ""
            //    "cursor", "url('" + new cursor().src + "'), auto", ""
            //);


            "Operation «Heat Zeeker»".ToDocumentTitle();

            //try
            //{
            //    //Console.WriteLine(new { chrome.app.isInstalled });

            //}
            //catch
            //{
            //    Console.WriteLine("error, not in chrome?");
            //}
        }
Ejemplo n.º 5
0
        // https://chrome.google.com/webstore/developer/dashboard/

        //FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Pages.TexturesImages
        //rewriting... done
        //2584:02:01 RewriteToAssembly error: System.ArgumentException: The unmanaged Version information is too large to persist.
        //   at System.Reflection.Emit.AssemblyBuilder.CreateVersionInfoResource(
        // String filename, String title, String iconFilename, String description, St
        // jsc how much description are you merging?


        // crx
        // https://chrome.google.com/webstore/detail/operation-heat-zeeker/iiabebggdceojiejhopnopmbkgandhha?hl=et&utm_source=chrome-ntp-launcher
        // use non chrome to download without install
        // http://clients2.google.com/service/update2/crx?response=redirect&x=id%3Diiabebggdceojiejhopnopmbkgandhha%26uc%26lang%3Den-US&prod=chrome
        // Download interrupted
        // means servers are not yet in sync, wait some
        // pbaaphpbkehboammnlcihpemkkimdfgo
        // http://clients2.google.com/service/update2/crx?response=redirect&x=id%3Dpbaaphpbkehboammnlcihpemkkimdfgo%26uc%26lang%3Den-US&prod=chrome
        // error-unknownApplication
        // Error 404

        //public readonly ApplicationWebService service = new ApplicationWebService();

        // https://groups.google.com/a/chromium.org/forum/#!msg/chromium-extensions/3sXvdfb5qk8/iMteKuIawcUJ
        // An error occurred: Failed to process your item.
        // background subsection of app section is not supported.

        // * New packaged apps are currently able to be searched and browsed in the Chrome Web Store by Windows and Chrome OS users on Chrome's developer channel. Users on other OSs and Chrome channels can view and install the app via a direct link.


        //Error	13	The type 'FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Pages.IApp' exists in both 
        //    'x:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\packages\Chrome.Web.Server.1.0.0.0\lib\Chrome Web Server.dll' and 
        //        'x:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\FlashHeatZeeker.PlayerIOIntegrationBeta2\bin\staging.AssetsLibrary\FlashHeatZeeker.PlayerIOIntegrationBeta2.AssetsLibrary.dll'	X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\FlashHeatZeeker.PlayerIOIntegrationBeta2\Application.cs	67	28	FlashHeatZeeker.PlayerIOIntegrationBeta2
        //Error	14	The type 'FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Images.FromAssets.Preview' exists in both 'X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\FlashHeatZeeker.PlayerIOIntegrationBeta2\bin\staging.AssetsLibrary\FlashHeatZeeker.PlayerIOIntegrationBeta2.AssetsLibrary.dll' and 'X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\packages\Chrome.Web.Server.1.0.0.0\lib\Chrome Web Server.dll'	X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\FlashHeatZeeker.PlayerIOIntegrationBeta2\Application.cs	123	81	FlashHeatZeeker.PlayerIOIntegrationBeta2
        //Error	15	The type 'FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Pages.AppSource' exists in both 'X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\FlashHeatZeeker.PlayerIOIntegrationBeta2\bin\staging.AssetsLibrary\FlashHeatZeeker.PlayerIOIntegrationBeta2.AssetsLibrary.dll' and 'X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\packages\Chrome.Web.Server.1.0.0.0\lib\Chrome Web Server.dll'	X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\FlashHeatZeeker.PlayerIOIntegrationBeta2\Application.cs	126	21	FlashHeatZeeker.PlayerIOIntegrationBeta2


        /// <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(xassets::FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Pages.IXApp page)
        {
            //method:Void .ctor(FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Pages.IXApp), ex = System.TypeLoadException: Could not load type 'ChromeTCPServer.TheServer' from assembly 'Chrome Web Server, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

            // https://code.google.com/p/chromium/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&groupby=&sort=&id=313673
            // https://code.google.com/p/chromium/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&groupby=&sort=&id=317352&thanks=317352&ts=1384094600

            // current way
            //FormStyler.AtFormCreated = s =>
            //{
            //    // X:\jsc.svn\examples\javascript\IsometricTycoonViewWithToolbar\IsometricTycoonViewWithToolbar\Application.cs
            //    // X:\jsc.internal.svn\core\com.abstractatech.web\com.abstractatech.web\Domains\discover.xavalon.net\discover_xavalon_net.cs

            //    // browser popup will use this color
            //    ((__Form)s.Context).HTMLTargetContainerRef.style.backgroundColor = JSColor.FromRGB(154, 108, 70);

            //    s.Caption.style.backgroundColor = JSColor.FromRGB(154, 108, 70);
            //    s.TargetOuterBorder.style.boxShadow = "rgba(154, 108, 70, 0.3) 0px 0px 6px 3px";
            //    s.TargetOuterBorder.style.borderColor = JSColor.FromRGB(154, 108, 70);

            //    s.TargetInnerBorder.style.borderWidth = "0px";

            //    s.CloseButton.style.color = JSColor.White;
            //    s.CloseButton.style.backgroundColor = JSColor.None;
            //    s.CloseButton.style.borderWidth = "0px";
            //    s.CloseButtonContent.style.borderWidth = "0px";

            //    s.TargetResizerPadding.style.left = "0px";
            //    s.TargetResizerPadding.style.top = "0px";
            //    s.TargetResizerPadding.style.right = "0px";
            //    s.TargetResizerPadding.style.bottom = "0px";

            //};


            // new way

            FormStyler.AtFormCreated =
                 s =>
                 {
                     s.Context.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

                     //var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDrag().AttachTo(s.Context.GetHTMLTarget());
                     var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDragWithShadow().AttachTo(s.Context.GetHTMLTarget());



                     s.Context.GetHTMLTarget().style.backgroundColor = "#A26D41";

                 };



            #region ChromeTCPServer
            dynamic self = Native.self;
            dynamic self_chrome = self.chrome;
            object self_chrome_socket = self_chrome.socket;

            if (self_chrome_socket != null)
            {
                Console.WriteLine("FlashHeatZeeker shall run as a chrome app as server");

                chrome.Notification.DefaultTitle = "Operation «Heat Zeeker»";
                chrome.Notification.DefaultIconUrl = new xassets::FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Images.FromAssets.Preview().src;

                ChromeTCPServer.TheServerWithStyledForm.Invoke(
                    xassets::FlashHeatZeeker.PlayerIOIntegrationBeta2.HTML.Pages.XAppSource.Text,
                    AtFormCreated: FormStyler.AtFormCreated

                    //AtFormConstructor:
                    //    f =>
                    //    {
                    //        //arg[0] is typeof System.Int32
                    //        //script: error JSC1000: No implementation found for this native method, please implement [static System.Drawing.Color.FromArgb(System.Int32)]

                    //        // X:\jsc.svn\examples\javascript\forms\Test\TestFromArgb\TestFromArgb\ApplicationControl.cs

                    //        f.BackColor = System.Drawing.Color.FromArgb(0xA26D41);
                    //    }
                );

                return;
            }
            #endregion



            // Your item is in the process of being published and may take up to 60 minutes to appear in the Chrome Web Store. 
            // https://chrome.google.com/webstore/detail/cpcgbahhjcobocclaolehaffhpfonofe/publish-delayed



            var sprite = new ApplicationSprite();



            sprite.AttachSpriteToDocument().With(
                   embed =>
                   {

                       // show thumbnail
                       // or click to enable plugin?
                       embed.style.SetLocation(0, 0);
                       //embed.style.SetSize(Native.window.Width, 96);
                       embed.style.SetSize(Native.window.Width, Native.window.Height);

                       //embed.style.transition = "height 200ms linear";

                       // after preloader or can we chime in before too?
                       sprite.WhenReady(
                           async delegate
                           {

                               embed.style.SetSize(Native.window.Width, Native.window.Height);


                               //embed.style.transition = "";


                               Native.window.onresize +=
                                   delegate
                                   {
                                       embed.style.SetSize(Native.window.Width, Native.window.Height);
                                   };

                               // this will not work if offline or lan only
                               // chrome webview needs to allow new window
                               // in order to log in. { loginstatus = unknown }

#if FFACEBOOK
                               var user = await FaceBook.API.Spy.GetCurrentUser();

                               new TitleElement { }.AttachToDocument().Container.innerText = user.name;
#endif


                               //new IHTMLDiv { innerText = user.name }.AttachToDocument().style.SetLocation(64, 8);


                           }
                       );
                   }
               );

            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2013/201310/20131029-nuget
            // wont work yet

            //IStyleSheet.all["*"].style.setProperty(
            //    //"cursor", "url('" + new _3dgarro().src + "'), auto", ""
            //    "cursor", "url('" + new cursor().src + "'), auto", ""
            //);


            "Operation «Heat Zeeker»".ToDocumentTitle();

            //try
            //{
            //    //Console.WriteLine(new { chrome.app.isInstalled });

            //}
            //catch
            //{
            //    Console.WriteLine("error, not in chrome?");
            //}

        }
Ejemplo n.º 6
0
        //public readonly ApplicationWebService service = new ApplicationWebService();

        /// <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(IDefault page)
        {


            // Unhandled Exception: System.InvalidOperationException: Method: get_InternalSiblingsIncludingThis, 
            // Type: ScriptCoreLib.JavaScript.BCLImplementation.System.Windows.Forms.__Control; emmiting failed : System.Exception: recursion detected at stack 32



            #region AtFormCreated
            FormStyler.AtFormCreated =
                 s =>
                 {


                     // now shadow
                     s.TargetOuterBorder.style.boxShadow = "";
                     //s.TargetOuterBorder.style.borderColor = JSColor.FromRGB(0, 122, 0);
                     //toolbar_color = Color.FromRGB(0, 0x80, 0)
                     Toolbar.JavaScript.Extensions.SetDialogColor(
                        s.TargetOuterBorder,
                        ScriptCoreLib.Shared.Drawing.Color.FromRGB(0, 0x80, 0),
                        true
                     );



                     s.TargetInnerBorder.style.borderWidth = "0px";
                     s.TargetInnerBorder.style.backgroundColor = JSColor.None;


                     s.CloseButton.style.color = JSColor.FromRGB(0, 80, 0);
                     s.CloseButton.style.backgroundColor = JSColor.None;
                     s.CloseButton.style.borderWidth = "0px";
                     s.CloseButtonContent.style.borderWidth = "0px";

                     s.TargetResizerPadding.style.left = "0px";
                     s.TargetResizerPadding.style.top = "0px";
                     s.TargetResizerPadding.style.right = "0px";
                     s.TargetResizerPadding.style.bottom = "0px";

                     // browser popup will use this color
                     ((__Form)s.Context).HTMLTargetContainerRef.style.backgroundColor = JSColor.FromRGB(0, 0x80, 0);

                     s.Caption.style.backgroundColor = JSColor.None;


                     //FormStyler.LikeVisualStudioMetro(s);
                 };
            #endregion




            #region TheServer
            dynamic self = Native.self;
            dynamic self_chrome = self.chrome;
            object self_chrome_socket = self_chrome.socket;

            if (self_chrome_socket != null)
            {

                FormStyler.AtFormCreated =
                  s =>
                  {
                      s.Context.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

                      //var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDrag().AttachTo(s.Context.GetHTMLTarget());
                      var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDragWithShadow().AttachTo(s.Context.GetHTMLTarget());
                  };

                chrome.Notification.DefaultTitle = "IsometricTycoonViewWithToolbar";
                ChromeTCPServer.TheServerWithStyledForm.Invoke(
                    DefaultSource.Text,
                    AtFormCreated: FormStyler.AtFormCreated
                );


                return;
            }
            #endregion


            //global::DiagnosticsConsole.ApplicationContent.BindKeyboardToDiagnosticsConsole();


            new gong().AttachToDocument().play();
            new ThreeDStuff.js.Tycoon4();


        }
Ejemplo n.º 7
0
        /// <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)
        {
            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201403/20140301
#if FCHROME
            FormStyler.AtFormCreated =
               s =>
               {
                   s.Context.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

                   //var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDrag().AttachTo(s.Context.GetHTMLTarget());
                   var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDragWithShadow().AttachTo(s.Context.GetHTMLTarget());
               };

            #region TheServer
            dynamic self = Native.self;
            dynamic self_chrome = self.chrome;
            object self_chrome_socket = self_chrome.socket;

            if (self_chrome_socket != null)
            {
                chrome.Notification.DefaultIconUrl = new HTML.Images.FromAssets.Preview().src;
                chrome.Notification.DefaultTitle = "Multitouch";


                ChromeTCPServer.TheServerWithStyledForm.Invoke(
                    AppSource.Text,
                    ApplicationSprite.DefaultWidth,
                    ApplicationSprite.DefaultHeight,
                    FormStyler.AtFormCreated
                );





                return;
            }
            #endregion

#endif

#if FCHROME
            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201501/20150110


            #region += Launched chrome.app.window
            // X:\jsc.svn\examples\javascript\chrome\apps\ChromeTCPServerAppWindow\ChromeTCPServerAppWindow\Application.cs
            dynamic self = Native.self;
            dynamic self_chrome = self.chrome;
            object self_chrome_socket = self_chrome.socket;

            if (self_chrome_socket != null)
            {
                //chrome.Notification.DefaultTitle = "Audi Visualization";
                //chrome.Notification.DefaultIconUrl = new x128().src;

                chrome.Notification.DefaultIconUrl = new HTML.Images.FromAssets.Preview().src;
                chrome.Notification.DefaultTitle = "MultitouchFingerTools.FlashLAN";


                ChromeTCPServer.TheServerWithAppWindow.Invoke(
                    AppSource.Text
                    );

                return;
            }
            #endregion
#endif


            var sprite = new ApplicationSprite();
            sprite.AttachSpriteToDocument().With(
                   embed =>
                   {
                       embed.style.SetLocation(0, 0);
                       embed.style.SetSize(Native.window.Width, Native.window.Height);

                       Native.window.onresize +=
                           delegate
                           {
                               embed.style.SetSize(Native.window.Width, Native.window.Height);
                           };
                   }
               );
        }
Ejemplo n.º 8
0
        //public readonly ApplicationWebService service = new ApplicationWebService();

        /// <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(IDefault page)
        {
            // Unhandled Exception: System.InvalidOperationException: Method: get_InternalSiblingsIncludingThis,
            // Type: ScriptCoreLib.JavaScript.BCLImplementation.System.Windows.Forms.__Control; emmiting failed : System.Exception: recursion detected at stack 32



            #region AtFormCreated
            FormStyler.AtFormCreated =
                s =>
            {
                // now shadow
                s.TargetOuterBorder.style.boxShadow = "";
                //s.TargetOuterBorder.style.borderColor = JSColor.FromRGB(0, 122, 0);
                //toolbar_color = Color.FromRGB(0, 0x80, 0)
                Toolbar.JavaScript.Extensions.SetDialogColor(
                    s.TargetOuterBorder,
                    ScriptCoreLib.Shared.Drawing.Color.FromRGB(0, 0x80, 0),
                    true
                    );



                s.TargetInnerBorder.style.borderWidth     = "0px";
                s.TargetInnerBorder.style.backgroundColor = JSColor.None;


                s.CloseButton.style.color              = JSColor.FromRGB(0, 80, 0);
                s.CloseButton.style.backgroundColor    = JSColor.None;
                s.CloseButton.style.borderWidth        = "0px";
                s.CloseButtonContent.style.borderWidth = "0px";

                s.TargetResizerPadding.style.left   = "0px";
                s.TargetResizerPadding.style.top    = "0px";
                s.TargetResizerPadding.style.right  = "0px";
                s.TargetResizerPadding.style.bottom = "0px";

                // browser popup will use this color
                ((__Form)s.Context).HTMLTargetContainerRef.style.backgroundColor = JSColor.FromRGB(0, 0x80, 0);

                s.Caption.style.backgroundColor = JSColor.None;


                //FormStyler.LikeVisualStudioMetro(s);
            };
            #endregion



            #region TheServer
            dynamic self               = Native.self;
            dynamic self_chrome        = self.chrome;
            object  self_chrome_socket = self_chrome.socket;

            if (self_chrome_socket != null)
            {
                FormStyler.AtFormCreated =
                    s =>
                {
                    s.Context.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

                    //var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDrag().AttachTo(s.Context.GetHTMLTarget());
                    var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDragWithShadow().AttachTo(s.Context.GetHTMLTarget());
                };

                chrome.Notification.DefaultTitle = "IsometricTycoonViewWithToolbar";
                ChromeTCPServer.TheServerWithStyledForm.Invoke(
                    DefaultSource.Text,
                    AtFormCreated: FormStyler.AtFormCreated
                    );


                return;
            }
            #endregion


            //global::DiagnosticsConsole.ApplicationContent.BindKeyboardToDiagnosticsConsole();


            new gong().AttachToDocument().play();
            new ThreeDStuff.js.Tycoon4();
        }
Ejemplo n.º 9
0
        // subst a: s:\jsc.svn\examples\javascript\chrome\apps\WebGL\ChromeGalaxyS6Edge\ChromeGalaxyS6Edge\bin\Debug\staging\ChromeGalaxyS6Edge.Application\web
        // Z:\jsc.svn\examples\javascript\chrome\apps\WebGL\ChromeGalaxyS6Edge\ChromeGalaxyS6Edge\bin\Debug\staging\ChromeGalaxyS6Edge.Application\web

		/// <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)
		{
            FormStyler.AtFormCreated =
            s =>
            {
                s.Context.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

                //var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDrag().AttachTo(s.Context.GetHTMLTarget());
                var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDragWithShadow().AttachTo(s.Context.GetHTMLTarget());



                s.Context.GetHTMLTarget().style.backgroundColor = "#efefef";
                //s.Context.GetHTMLTarget().style.backgroundColor = "#A26D41";

            };

			#region += Launched chrome.app.window
			// X:\jsc.svn\examples\javascript\chrome\apps\ChromeTCPServerAppWindow\ChromeTCPServerAppWindow\Application.cs
			dynamic self = Native.self;
			dynamic self_chrome = self.chrome;
			object self_chrome_socket = self_chrome.socket;

			if (self_chrome_socket != null)
			{
				//chrome.Notification.DefaultTitle = "Nexus7";
				//chrome.Notification.DefaultIconUrl = new x128().src;
                ChromeTCPServer.TheServerWithStyledForm.Invoke(
                     AppSource.Text,
                    AtFormCreated: FormStyler.AtFormCreated

                    //AtFormConstructor:
                    //    f =>
                    //    {
                    //        //arg[0] is typeof System.Int32
                    //        //script: error JSC1000: No implementation found for this native method, please implement [static System.Drawing.Color.FromArgb(System.Int32)]

                    //        // X:\jsc.svn\examples\javascript\forms\Test\TestFromArgb\TestFromArgb\ApplicationControl.cs

                    //        f.BackColor = System.Drawing.Color.FromArgb(0xA26D41);
                    //    }
                );
				return;
			}
			#endregion

			Native.body.Clear();

			var oo = new List<THREE.Object3D>();

			#region scene
			var window = Native.window;

			var camera = new THREE.PerspectiveCamera(
				45,
				window.aspect,
				1,
				2000
				);
			camera.position.z = 400;

			// scene

			var scene = new THREE.Scene();

			var ambient = new THREE.AmbientLight(0x303030);
			scene.add(ambient);

			var directionalLight = new THREE.DirectionalLight(0xffffff, 0.7);
			directionalLight.position.set(0, 0, 1);
			scene.add(directionalLight);

			// WebGLRenderer preserveDrawingBuffer 
			var renderer = new THREE.WebGLRenderer(

				new
				{
					antialias = true,
					alpha = true,
					preserveDrawingBuffer = true
				}
			);

			// https://github.com/mrdoob/three.js/issues/3836
			//renderer.setClearColor(0xfffff, 1);

			renderer.setSize(window.Width, window.Height);

			renderer.domElement.AttachToDocument();
			renderer.domElement.style.SetLocation(0, 0);

			var canvas = (IHTMLCanvas)renderer.domElement;


			var old = new
			{



				CursorX = 0,
				CursorY = 0
			};


			var mouseX = 0;
			var mouseY = 0;
			var st = new Stopwatch();
			st.Start();


			canvas.css.active.style.cursor = IStyle.CursorEnum.move;

			#region onmousedown
			canvas.onmousedown +=
				e =>
				{

					if (e.MouseButton == IEvent.MouseButtonEnum.Middle)
					{
						canvas.requestFullscreen();
					}
					else
					{
						// movementX no longer works
						old = new
						{


							e.CursorX,
							e.CursorY
						};


						e.CaptureMouse();
					}

				};
			#endregion



			// X:\jsc.svn\examples\javascript\Test\TestMouseMovement\TestMouseMovement\Application.cs
			#region onmousemove
			canvas.onmousemove +=
				e =>
				{
					var pointerLock = canvas == Native.document.pointerLockElement;


					//Console.WriteLine(new { e.MouseButton, pointerLock, e.movementX });

					if (e.MouseButton == IEvent.MouseButtonEnum.Left)
					{

						oo.WithEach(
							x =>
							{
								x.rotation.y += 0.006 * (e.CursorX - old.CursorX);
								x.rotation.x += 0.006 * (e.CursorY - old.CursorY);
							}
						);

						old = new
						{


							e.CursorX,
							e.CursorY
						};



					}

				};
			#endregion
			var z = camera.position.z;

			#region onmousewheel
			canvas.onmousewheel +=
				e =>
				{
					//camera.position.z = 1.5;

					// min max. shall adjust speed also!
					// max 4.0
					// min 0.6
					z -= 10.0 * e.WheelDirection;

					//camera.position.z = 400;
					z = z.Max(200).Min(500);

					//Native.document.title = new { z }.ToString();

				};
			#endregion


			Native.window.onframe +=
				e =>
				{
					renderer.clear();

					camera.aspect = canvas.aspect;
					camera.updateProjectionMatrix();

					camera.position.z += (z - camera.position.z) * e.delay.ElapsedMilliseconds / 200;


					camera.lookAt(scene.position);

					renderer.render(scene, camera);


				};

			Native.window.onresize +=
				delegate
				{
					if (canvas.parentNode == Native.document.body)
					{
						renderer.setSize(window.Width, window.Height);
					}

				};
			#endregion

			// THREE.WebGLProgram: gl.getProgramInfoLog() (79,3-98): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll

			new Models.ColladaS6Edge().Source.Task.ContinueWithResult(
				   dae =>
				   {
					   // 90deg
					   dae.rotation.x = -Math.Cos(Math.PI);

					   //dae.scale.x = 30;
					   //dae.scale.y = 30;
					   //dae.scale.z = 30;
					   dae.position.z = 65;

                       var scale = 0.7;

					   // jsc, do we have ILObserver available yet?
                       dae.scale.x = scale;
                       dae.scale.y = scale;
                       dae.scale.z = scale;

					   //dae.position.y = -80;

					   scene.add(dae);
					   oo.Add(dae);


				   }
			   );

			Console.WriteLine("do you see it?");
		}
Ejemplo n.º 10
0
        /// <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)
        {
            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201403/20140301
#if FCHROME
            FormStyler.AtFormCreated =
                s =>
            {
                s.Context.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

                //var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDrag().AttachTo(s.Context.GetHTMLTarget());
                var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDragWithShadow().AttachTo(s.Context.GetHTMLTarget());
            };

            #region TheServer
            dynamic self               = Native.self;
            dynamic self_chrome        = self.chrome;
            object  self_chrome_socket = self_chrome.socket;

            if (self_chrome_socket != null)
            {
                chrome.Notification.DefaultIconUrl = new HTML.Images.FromAssets.Preview().src;
                chrome.Notification.DefaultTitle   = "Multitouch";


                ChromeTCPServer.TheServerWithStyledForm.Invoke(
                    AppSource.Text,
                    ApplicationSprite.DefaultWidth,
                    ApplicationSprite.DefaultHeight,
                    FormStyler.AtFormCreated
                    );



                return;
            }
            #endregion
#endif

#if FCHROME
            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201501/20150110


            #region += Launched chrome.app.window
            // X:\jsc.svn\examples\javascript\chrome\apps\ChromeTCPServerAppWindow\ChromeTCPServerAppWindow\Application.cs
            dynamic self               = Native.self;
            dynamic self_chrome        = self.chrome;
            object  self_chrome_socket = self_chrome.socket;

            if (self_chrome_socket != null)
            {
                //chrome.Notification.DefaultTitle = "Audi Visualization";
                //chrome.Notification.DefaultIconUrl = new x128().src;

                chrome.Notification.DefaultIconUrl = new HTML.Images.FromAssets.Preview().src;
                chrome.Notification.DefaultTitle   = "MultitouchFingerTools.FlashLAN";


                ChromeTCPServer.TheServerWithAppWindow.Invoke(
                    AppSource.Text
                    );

                return;
            }
            #endregion
#endif


            var sprite = new ApplicationSprite();
            sprite.AttachSpriteToDocument().With(
                embed =>
            {
                embed.style.SetLocation(0, 0);
                embed.style.SetSize(Native.window.Width, Native.window.Height);

                Native.window.onresize +=
                    delegate
                {
                    embed.style.SetSize(Native.window.Width, Native.window.Height);
                };
            }
                );
        }