public void Run()
        {
            BBUtil _util;
            using (var nav = new Navigator())
            using (var ctx = new Context(ContextType.SCREEN_APPLICATION_CONTEXT))
            using (var win = new Window(ctx))
            {
                _util = new BBUtil(ctx);

                Egl.QuerySurface(_util.Display, _util.Surface, Egl.WIDTH, out viewportWidth);
                Egl.QuerySurface(_util.Display, _util.Surface, Egl.HEIGHT, out viewportHeight);

                Console.WriteLine("viewportWidth: " + viewportWidth);
                Console.WriteLine("viewportHeight: " + viewportHeight);

                this.OnLoad(_util);

                nav.OnExit += () =>
                {
                    Console.WriteLine("I am asked to shutdown!?!");
                    PlatformServices.Shutdown(0);
                };

                PlatformServices.Run(null);
            }
        }
Exemple #2
0
        public void Run()
        {
            using (var nav = new Navigator())
            using (var ctx = new Context(ContextType.SCREEN_APPLICATION_CONTEXT))
            using (var win = new Window(ctx))
            {
                win.Usage = UsageFlagType.SCREEN_USAGE_NATIVE;
                win.CreateBuffers(2);
                var bufs = win.Buffers;
                var pic = bufs[0];
                var brush = bufs[1];

                Blits.Fill(ctx, pic, 64441078);
                Blits.Fill(ctx, brush, 0xffff0000 );
                win.Render(pic);

                nav.OnSwipeDown += (() => Dialog.Alert ("#MonoBerry", "Another Event Loop", new Button ("Ack")));
                ctx.OnFingerTouch += (x, y) =>
                {
                    Blits.Blit(ctx, brush, pic, 0, 0, 10, 10, Math.Max(x - 5, 0), Math.Max(y - 5, 0));
                    win.Render(pic);
                };
                ctx.OnFingerMove = ctx.OnFingerTouch;
                ctx.OnFingerRelease = ctx.OnFingerTouch;

                nav.OnExit += () =>
                {
                    Console.WriteLine("I am asked to shutdown!?!");
                    PlatformServices.Shutdown(0);
                };

                PlatformServices.Run(null);
            }
        }
        public void Run()
        {
            using (var nav = new Navigator())
            using (var ctx = new Context(ContextType.SCREEN_APPLICATION_CONTEXT))
            using (var win = new Window(ctx, WindowType.SCREEN_APPLICATION_WINDOW))
            {
                string groupName = "TheTeam";
                win.CreateWindowGroup(groupName);

                win.CreateBuffers(10);
                win.Identifier = "parent";

                var r = new Random();
                foreach (var b in win.Buffers)
                {
                    Blits.Fill(ctx, b, (uint)r.Next());
                    win.Render(b);
                    System.Threading.Thread.Sleep(200);
                }

                Window childWindow = new Window(ctx, WindowType.SCREEN_CHILD_WINDOW);
                childWindow.JoinWindowGroup(groupName);
                childWindow.CreateBuffer();
                childWindow.Identifier = "child";

                Blits.Fill(ctx, childWindow.Buffers[0], 50);
                childWindow.Render(childWindow.Buffers[0]);

                SoundPlayer sp = new SoundPlayer(SoundPlayer.SystemSounds.EventDeviceUntether);
                sp.PlaySound();
                VirtualKeyboard kb = new VirtualKeyboard();
                Orientation or= new Orientation();
                var run = true;
                string message=string.Format("Monoberry Runtime!. BPS Version: {0} Direction: {1}",PlatformServices.GetVersionBPS().ToString(), or.CurrentDirection.ToString());
                while (run)
                {
                    Dialog.Alert("CLOSE ME!", message,
                        //new Button ("Timer", Timer),
                        //new Button ("Camera", Cam),
                        //new Button ("Messages", () => nav.Invoke ("messages://")),
                                  //new Button("Show Keyboard", () => kb.Show()),
                                  new Button("Play Random Sound", () => this.PlaySound(sp, r)),
                                  new Button("Badge", () => nav.HasBadge = true),
                                  new Button("Browser", () => nav.Invoke("http://www.bing.com/")),
                                  new Button("Close", () => run = false));
                }
            }
        }
        private Window CreateBackgroundWindow(string groupName, Context ctx)
        {
            Window wind = new Window(ctx);
            wind.CreateWindowGroup(groupName);
            wind.IsVisible = false;

            int color = unchecked((int)13493586);
            wind.Color = color;

            wind.CreateBuffer();
            wind.SetDimensions(700, 500);

            wind.Identifier = "ID500";

            return wind;
        }
Exemple #5
0
 public void Run()
 {
     _ctx = new Context(BlackberryPlatformServices.Screen.Types.ContextType.SCREEN_APPLICATION_CONTEXT);
     PlatformServices.Initialize();
     using (var win = new Window(_ctx, WindowType.SCREEN_APPLICATION_WINDOW))
     {
         _util = new BBUtil(_ctx);
         this.Initialize();
         string groupName = "TheTeam";
         win.CreateWindowGroup(groupName);
         win.CreateBuffer();
         while (true)
         {
             this.Draw();
         }
     }
 }
Exemple #6
0
        public void Run()
        {
            using (var nav = new Navigator())
            using (var ctx = new Context(ContextType.SCREEN_APPLICATION_CONTEXT))
            using (var win = new Window(ctx))
            {
                _util = new BBUtil(ctx);

                this.Initialize();
                nav.RotationLock = false;
                bool exit_application = false;

                nav.OnExit = () =>
                {
                    Console.WriteLine("I am asked to shutdown!?!");
                    PlatformServices.Shutdown(0);
                    exit_application = true;
                };

                //while (!exit_application)
                //{
                    //Event e = null;
                    //for (; ; )
                    //{
                    //    PlatformServices.GetEvent(out e, 0);
                    //    if (e != null)
                    //    {
                    //        int domain = PlatformServices.GetDomainByEvent(e.Handle);

                    //        if (domain == Screen.GetDomain())
                    //            this.handleScreenEvent(e);
                    //        else if (domain == nav.Domain && (int)e.Code == (int)Navigator.EventType.NAVIGATOR_EXIT)
                    //            exit_application = true;
                    //    }
                    //    else
                    //        break;
                    //}

                    this.Render();
                //}
                PlatformServices.Run(this.Render);
                _util.Dispose();
            }
        }
Exemple #7
0
        public void Run()
        {
            _rateOfRotationPS = new float[] { 30, 45, 60 };
            _rot = new float[] { 0, 0, 0 };

            BBUtil _util;
            using (var nav = new Navigator())
            using (var ctx = new Context(ContextType.SCREEN_APPLICATION_CONTEXT))
            using (var win = new Window(ctx))
            {
                _util = new BBUtil(ctx);

                Egl.QuerySurface(_util.Display, _util.Surface, Egl.WIDTH, out _viewportWidth);
                Egl.QuerySurface(_util.Display, _util.Surface, Egl.HEIGHT, out _viewportHeight);

                this.OnLoad(_util);

                nav.OnExit += () =>
                {
                    Console.WriteLine("I am asked to shutdown!?!");
                    PlatformServices.Shutdown(0);
                };
            }
        }
Exemple #8
0
 internal void UnregisterWindow(Window win)
 {
     _windows.Remove(win.Handle);
 }
Exemple #9
0
 internal void RegisterWindow(Window win)
 {
     _windows.Add(win.Handle, win);
 }
Exemple #10
0
 public ScreenEffect(Window win)
 {
     _window = win;
 }
Exemple #11
0
 public void ShareDisplayBuffers(Window win, int count=0)
 {
     if (screen_share_display_buffers(win.Handle, _handle, count) != 0)
         throw new Exception("Unable to share buffers.");
 }