Inheritance: IDisposable
Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            using (var nav = new Navigator ())
            using (var ctx = new Context ())
            using (var win = new Window (ctx)) {
                win.Usage = Usage.SCREEN_USAGE_NATIVE;
                win.AddBuffers (2);
                var bufs = win.Buffers;
                var pic = bufs[0];
                var brush = bufs[1];

                pic.Fill (0xffff0000);
                brush.Fill (0xff000000);
                win.Render (pic);

                //nav.OnSwipeDown = () => Dialog.Alert ("#MonoBerry", "Another Event Loop", new Button ("Ack"));
                ctx.OnFingerTouch = (x,y) => {
                    pic.Blit (brush, 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;

                PlatformServices.Run ();
            }
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            using (var nav = new Navigator ())
            using (var ctx = new Context ())
            using (var win = new Window (ctx, WindowType.SCREEN_APPLICATION_WINDOW)) {
                win.AddBuffers (10);
                win.Identifier = "bla";
                var r = new Random();
                foreach (var b in win.Buffers) {
                    b.Fill (r.Next ());
                    win.Render (b);
                    System.Threading.Thread.Sleep (200);
                }
                //nav.AddUri ("", "Browser", "default", "http://google.com/");
                //nav.AddUri ("", "Messages", "default", "messages://");
                //return;

                var run = true;
                while (run) {
                    Dialog.Alert ("CLOSE ME!", "jpo1jo1j1oj1oj1",
                                  //new Button ("Timer", Timer),
                                  //new Button ("Camera", Cam),
                                  //new Button ("Messages", () => nav.Invoke ("messages://")),
                                  new Button ("Badge", () => nav.HasBadge = true),
                                  new Button ("Browser", () => nav.Invoke ("http://google.com/")),
                                  new Button ("Close", () => run = false));
                }
            }
        }
Exemplo n.º 3
0
 //public Window () : this (Context.GetInstance (ContextType.Application)) {}
 //public Window (WindowType type) : this (Context.GetInstance (ContextType.Application), type) {}
 public Window(Context ctx, WindowType type = WindowType.SCREEN_APPLICATION_WINDOW)
 {
     context = ctx;
     if (screen_create_window_type (out handle, ctx.Handle, type) != 0) {
         throw new Exception ("Unable to create window");
     }
     if (type != WindowType.SCREEN_APPLICATION_WINDOW &&
         type != WindowType.SCREEN_CHILD_WINDOW) {
         return;
     }
     if (screen_create_window_group (handle, handle.ToString ()) != 0) {
         throw new Exception ("Unable to create window group");
     }
     context.RegisterWindow (this);
 }
Exemplo n.º 4
0
 public Buffer(Context ctx, IntPtr buf)
 {
     context = ctx;
     buffer = buf;
 }
Exemplo n.º 5
0
 public Buffer(Context ctx, Window win, IntPtr hndl)
 {
     context = ctx;
     window = win;
     handle = hndl;
 }
Exemplo n.º 6
0
 public Window(Context ctx, IntPtr hnd)
 {
     context = ctx;
     handle = hnd;
 }
Exemplo n.º 7
0
 public static Context GetInstance(ContextType type)
 {
     lock (typeof (Context)) {
         Context ctx;
         if (!instances.TryGetValue (type, out ctx)) {
             ctx = new Context (type);
             instances.Add (type, ctx);
         }
         return ctx;
     }
 }