コード例 #1
0
        public Application(IApp page)
        {
            var sprite = new ApplicationSprite();

            sprite.AutoSizeSpriteTo(page.ContentSize);
            sprite.AttachSpriteTo(page.Content);

            sprite.InitializeContent();

            sprite.AfterInitializeContent();
        }
コード例 #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
            #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;

                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);
                           };
                   }
               );

        }
コード例 #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(IApp page)
        {
#if FCHROME
            #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;

                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);
                };
            }
                );
        }
コード例 #4
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)
        {
            sprite.wmode();

            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);
                           };
                   }
               );


            #region con
            var con = new ConsoleForm();

            con.InitializeConsoleFormWriter();

            con.Show();

            con.Height = 150;
            con.Left = Native.Window.Width - con.Width;
            con.Top = 0;

            Native.Window.onresize +=
                  delegate
                  {
                      con.Left = Native.Window.Width - con.Width;
                      con.Top = 0;
                  };


            con.Opacity = 0.6;




            // !! not compatible yet

            con.HandleFormClosing = false;
            con.PopupInsteadOfClosing();
            #endregion



            sprite.fps +=
                (fps, nid) =>
                {
                    new { fps, nid }.ToString().ToDocumentTitle();
                };


            #region context_new_remotegame
            sprite.context_new_remotegame +=
                remotegame =>
                {
                    var remotegame_con = new ConsoleForm();

                    remotegame_con.Show();
                    remotegame_con.Left = 0;
                    remotegame_con.Top = Native.Window.Height - remotegame_con.Height;

                    remotegame_con.Opacity = 0.5;

                    remotegame.AtTitleChange +=
                        e => remotegame_con.Text = e;

                    remotegame.AtWriteLine +=
                        e =>
                        {
                            remotegame_con.textBox1.AppendText(e + Environment.NewLine);
                            remotegame_con.textBox1.ScrollToCaret();
                        };


                    remotegame_con.HandleFormClosing = false;
                    remotegame_con.PopupInsteadOfClosing();
                };
            #endregion


            var sprites_events = new BindingListWithEvents<ApplicationSprite>();
            var sprites = sprites_events.Source;

            sprites_events.Added +=
                (fsprite, i) =>
                {
                    Console.WriteLine(i + "# Console ready!");

                    fsprite.InitializeConsoleFormWriter(
                        Console_Write: x => Console.Write(x),
                        Console_WriteLine: x =>
                            {
                                var lines = x.Split(Environment.NewLine);

                                foreach (var item in lines)
                                {
                                    Console.WriteLine(i + "# " + item);
                                }
                            }
                    );

                    #region lets do two way binding here.



                    // fsprite -> sprite
                    fsprite.context_onmessage += xml =>
                    {
                        // script: error JSC1000: No implementation found for this native method, please implement [static System.Linq.Enumerable.Except(System.Collections.Generic.IEnumerable`1[[FlashHeatZeekerWithStarlingB2.ApplicationSprite, FlashHeatZeekerWithStarlingB2.Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Collections.Generic.IEnumerable`1[[FlashHeatZeekerWithStarlingB2.ApplicationSprite, FlashHeatZeekerWithStarlingB2.Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]])]

                        sprites.WithEach(
                            x =>
                            {
                                // prevent echo
                                if (x == fsprite)
                                    return;

                                x.game_postMessage(xml);
                            }
                        );
                    };

                    #endregion
                };


            sprites.Add(sprite);

            #region game_InitializeFrameDiagnostics
            sprite.game_InitializeFrameDiagnostics(
                __FrameDiagnostics =>
                {
                    Console.WriteLine("new FrameDiagnostics");

                    var x = new FrameDiagnostics();

                    x.Show();

                    Console.WriteLine("new FrameDiagnostics Show, can you see it?");


                    Native.Window.onresize +=
                      delegate
                      {
                          x.Left = Native.Window.Width - x.Width;
                          x.Top = Native.Window.Height - x.Height;
                      };


                    x.Initialize(__FrameDiagnostics);

                    // Error	8	'Abstractatech.ConsoleFormPackage.Library.ConsoleForm' does not contain a definition for 'PopupInsteadOfClosing' and no extension method 'PopupInsteadOfClosing' accepting a first argument of type 'Abstractatech.ConsoleFormPackage.Library.ConsoleForm' could be found (are you missing a using directive or an assembly reference?)	X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\FlashHeatZeekerWithStarlingB2\Application.cs	85	17	FlashHeatZeekerWithStarlingB2
                    // wtf?
                    x.PopupInsteadOfClosing();
                    x.Opacity = 0.7;

                    // can we pop it up?


                    x.JoinMultiplayer.Click +=
                        delegate
                        {
                            var f = new Form();
                            // make it small
                            f.Height = 200;

                            var fsprite = new ApplicationSprite();
                            fsprite.src_fixup();
                            fsprite.wmode();


                            var fspriteelement = fsprite.AttachSpriteTo(
                                f.GetHTMLTargetContainer()
                            );

                            #region ClientSizeChanged / PopupInsteadOfClosing has a bug
                            f.ClientSizeChanged +=
                                delegate
                                {
                                    var cs = f.ClientSize;

                                    fspriteelement.style.SetSize(cs.Width,
                                        cs.Height
                                    );
                                };
                            #endregion

                            f.Show();
                            f.PopupInsteadOfClosing();

                            // do events break if popup mode is changed?
                            fsprite.fps +=
                                  (fps, nid) =>
                                  {
                                      new { fps, nid }.ToString().ToTitle(f);
                                  };




                            sprites.Add(fsprite);
                            // what if we have more of these?
                        };
                }
            );
            #endregion








        }
コード例 #5
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)
        {
            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);
                };
            }
                );


            #region con
            var con = new ConsoleForm();

            con.InitializeConsoleFormWriter();

            con.Show();

            con.Height = 150;
            con.Left   = Native.window.Width - con.Width;
            con.Top    = 0;

            Native.window.onresize +=
                delegate
            {
                con.Left = Native.window.Width - con.Width;
                con.Top  = 0;
            };


            con.Opacity = 0.6;



            // !! not compatible yet

            con.HandleFormClosing = false;
            con.PopupInsteadOfClosing();
            #endregion



            sprite.fps +=
                (fps, nid) =>
            {
                new { fps, nid }.ToString().ToDocumentTitle();
            };


            #region context_new_remotegame
            sprite.context_new_remotegame +=
                remotegame =>
            {
                var remotegame_con = new ConsoleForm();

                remotegame_con.Show();
                remotegame_con.Left = 0;
                remotegame_con.Top  = Native.window.Height - remotegame_con.Height;

                remotegame_con.Opacity = 0.5;

                remotegame.AtTitleChange    +=
                    e => remotegame_con.Text = e;

                remotegame.AtWriteLine +=
                    e =>
                {
                    remotegame_con.textBox1.AppendText(e + Environment.NewLine);
                    remotegame_con.textBox1.ScrollToCaret();
                };


                remotegame_con.HandleFormClosing = false;
                remotegame_con.PopupInsteadOfClosing();
            };
            #endregion


            var sprites_events = new BindingListWithEvents <ApplicationSprite>();
            var sprites        = sprites_events.Source;

            sprites_events.Added +=
                (fsprite, i) =>
            {
                Console.WriteLine(i + "# Console ready!");

                fsprite.InitializeConsoleFormWriter(
                    Console_Write: x => Console.Write(x),
                    Console_WriteLine: x =>
                {
                    var lines = x.Split(Environment.NewLine);

                    foreach (var item in lines)
                    {
                        Console.WriteLine(i + "# " + item);
                    }
                }
                    );

                #region lets do two way binding here.



                // fsprite -> sprite
                fsprite.context_onmessage += xml =>
                {
                    // script: error JSC1000: No implementation found for this native method, please implement [static System.Linq.Enumerable.Except(System.Collections.Generic.IEnumerable`1[[FlashHeatZeekerWithStarlingT04.ApplicationSprite, FlashHeatZeekerWithStarlingT04.Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Collections.Generic.IEnumerable`1[[FlashHeatZeekerWithStarlingT04.ApplicationSprite, FlashHeatZeekerWithStarlingT04.Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]])]

                    sprites.WithEach(
                        x =>
                    {
                        // prevent echo
                        if (x == fsprite)
                        {
                            return;
                        }

                        x.game_postMessage(xml);
                    }
                        );
                };

                #endregion
            };


            sprites.Add(sprite);

            #region game_InitializeFrameDiagnostics
            sprite.game_InitializeFrameDiagnostics(
                __FrameDiagnostics =>
            {
                Console.WriteLine("new FrameDiagnostics");

                var x = new FrameDiagnostics();

                x.Show();

                Console.WriteLine("new FrameDiagnostics Show, can you see it?");


                Native.window.onresize +=
                    delegate
                {
                    x.Left = Native.window.Width - x.Width;
                    x.Top  = Native.window.Height - x.Height;
                };


                x.Initialize(__FrameDiagnostics);

                // Error	8	'Abstractatech.ConsoleFormPackage.Library.ConsoleForm' does not contain a definition for 'PopupInsteadOfClosing' and no extension method 'PopupInsteadOfClosing' accepting a first argument of type 'Abstractatech.ConsoleFormPackage.Library.ConsoleForm' could be found (are you missing a using directive or an assembly reference?)	X:\jsc.svn\examples\actionscript\svg\FlashHeatZeeker\FlashHeatZeekerWithStarlingT04\Application.cs	85	17	FlashHeatZeekerWithStarlingT04
                // wtf?
                x.PopupInsteadOfClosing();
                x.Opacity = 0.7;

                // can we pop it up?


                x.JoinMultiplayer.Click +=
                    delegate
                {
                    var f = new Form();
                    // make it small
                    f.Height = 200;

                    var fsprite = new ApplicationSprite();
                    fsprite.src_fixup();
                    fsprite.wmode();


                    var fspriteelement = fsprite.AttachSpriteTo(
                        f.GetHTMLTargetContainer()
                        );

                    #region ClientSizeChanged / PopupInsteadOfClosing has a bug
                    f.ClientSizeChanged +=
                        delegate
                    {
                        var cs = f.ClientSize;

                        fspriteelement.style.SetSize(cs.Width,
                                                     cs.Height
                                                     );
                    };
                    #endregion

                    f.Show();
                    //f.PopupInsteadOfClosing();

                    // do events break if popup mode is changed?
                    fsprite.fps +=
                        (fps, nid) =>
                    {
                        new { fps, nid }.ToString().ToTitle(f);
                    };



                    sprites.Add(fsprite);
                    // what if we have more of these?
                };
            }
                );
            #endregion
        }