Exemplo n.º 1
0
        // not roslyn friendly?

        /// <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)
        {
            // where does the tcp server put the memory?

            #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   = "NatureBoyTestPadExperiment";


                ChromeTCPServer.TheServerWithStyledForm.Invoke(
                    AppSource.Text
                    );

                return;
            }
            #endregion

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


            #region music
            var music = default(world);

            Action loop = null;

            loop = delegate
            {
                music = new world {
                    volume = 0.1
                }.AttachToDocument();

                music.onended +=
                    delegate
                {
                    Console.WriteLine(" music.onended ");
                    music.Orphanize();

                    loop();
                };

                music.play();
            };

            loop();
            #endregion

            //music.setAttribute("loop", "loop");

            new[]
            {
                new [] {
                    Frames.WolfSoldier,
                    Frames.DoomImp,
                    MyFrames.NPC3.Frames_Stand,
                    MyFrames.ManWithHorns.Frames_Stand,
                    MyFrames.ThePig.Frames_Stand,
                    MyFrames.TheSheep.Frames_Stand,
                },
                Frames.WolfSoldier_Walk,
                Frames.DoomImp_Walk,
                MyFrames.NPC3.Frames_Walk,
                MyFrames.ManWithHorns.Frames_Walk
            }.ContinueAfterImagesReady(

                // why cannot we just set progress and skip innerText, should work, a bug?
                c => page.progress.innerText = c + " images loaded"
                )(
                NatureBoyTestPad.js.NatureBoyTestPad.InitializeContent
                );
        }
Exemplo n.º 2
0
        // not roslyn friendly?

        /// <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)
        {
            // where does the tcp server put the memory?

            #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 = "NatureBoyTestPadExperiment";


                ChromeTCPServer.TheServerWithStyledForm.Invoke(
                    AppSource.Text
                );

                return;
            }
            #endregion

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


            #region music
            var music = default(world);

            Action loop = null;

            loop = delegate
            {
                music = new world { volume = 0.1 }.AttachToDocument();

                music.onended +=
                    delegate
                    {
                        Console.WriteLine(" music.onended ");
                        music.Orphanize();

                        loop();
                    };

                music.play();

            };

            loop();
            #endregion

            //music.setAttribute("loop", "loop");

            new[]
            {
                new [] {
                Frames.WolfSoldier,
                Frames.DoomImp,
                MyFrames.NPC3.Frames_Stand,
                MyFrames.ManWithHorns.Frames_Stand,
                MyFrames.ThePig.Frames_Stand,
                MyFrames.TheSheep.Frames_Stand,
                },
                Frames.WolfSoldier_Walk,
                Frames.DoomImp_Walk,
                MyFrames.NPC3.Frames_Walk,
                MyFrames.ManWithHorns.Frames_Walk
            }.ContinueAfterImagesReady(

                    // why cannot we just set progress and skip innerText, should work, a bug?
                c => page.progress.innerText = c + " images loaded"
            )(
                 NatureBoyTestPad.js.NatureBoyTestPad.InitializeContent
            );

        }