Invoke() 공개 메소드

public Invoke ( InvokeRequest invocation ) : void
invocation InvokeRequest
리턴 void
예제 #1
0
        public static void Main(string[] args)
        {
            using (var nav = new Navigator ())
            using (var ctx = Context.GetInstance (ContextType.Application))
            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 ((uint)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));
                }
            }
        }
예제 #2
0
        public void Run()
        {
            using (var nav = new Navigator ()) {
                try {
                    nav.SetOrientation (Navigator.ScreenOrientation.Landscape);
                } catch (Exception e) {
                    Console.WriteLine ("ScreenOrientation Error: {0}\n{1}", e.Message, e.StackTrace);
                }
                try {
                    nav.SetOrientation (Navigator.ApplicationOrientation.TopUp);
                } catch (Exception e) {
                    Console.WriteLine ("ApplicationOrientation Error: {0}\n{1}", e.Message, e.StackTrace);
                }
                try {
                    nav.OrientationLock = true;
                } catch (Exception e) {
                    Console.WriteLine ("OrientationLock Error: {0}\n{1}", e.Message, e.StackTrace);
                }
                using (var ctx = Context.GetInstance (ContextType.Application))
                using (window = new Window (ctx)) {
                    window.KeepAwake = true;
                    window.AddBuffer ();
                    buffer = window.Buffers [0];
                    width = window.Width;
                    height = window.Height;
                    graphics = Graphics.FromImage (buffer.Bitmap);

                    SoundPlayer.Prepare (SoundPlayer.SystemSound.AlarmBattery);

                    msecsLeft = LIGHTNING_TALK_TIME;
                    timer = new System.Timers.Timer ();
                    timer.AutoReset = true;
                    timer.Interval = 100;
                    timer.Elapsed += (sender, e) => {
                        msecsLeft -= 100;
                        if (msecsLeft <= 0) {
                            timer.Enabled = false;
                            SoundPlayer.Play (SoundPlayer.SystemSound.AlarmBattery);
                        }
                        RenderSlide ();
                    };

                    nav.OnSwipeDown = () =>
                        Dialog.Alert ("Lightning Talk",
                            "Add slides as *.jpg files to your ‘documents’ folder or a subdirectory. " +
                            "Touch screen or use a bluetooth remote to switch slides.\n\n" +
                            "©2013 by @roblillack.\nLicensed under the MIT license.",
                            new Button ("Countdown 5 mins", () => {
                      			msecsLeft = LIGHTNING_TALK_TIME;
                                timer.Enabled = true;
                            }),
                            new Button ("Show Source Code", () =>
                                nav.Invoke ("http://github.com/roblillack/lightning-talk")));

                    ctx.OnFingerTouch = (x, y) => {
                        if (x < window.Width / 2) {
                            PreviousSlide ();
                        } else {
                            NextSlide ();
                        }
                    };
                    ctx.OnKeyDown = (code, _) => {
                        if (code == KeyCode.Up) {
                            PreviousSlide ();
                        } else {
                            NextSlide ();
                        }
                    };

                    nav.OnExit = () => {
                        PlatformServices.Shutdown (0);
                    };

                    renderThread = new Thread (RenderLoop);
                    renderThread.Start ();

                    DirectoryInfo dirInfo = new DirectoryInfo ("shared/documents");
                    images = new ImageCache (dirInfo.GetFiles ("*.jpg", SearchOption.AllDirectories), new Size (width, height));
                    if (images.Length == 0) {
                        Dialog.Alert ("Lightning Talk",
                                      "No presentation slides found! Please add *.jpg files to your ‘documents’ folder or a subdirectory!",
                                      new Button ("Quit", () => PlatformServices.Shutdown (0)));
                    }

                    RenderSlide ();

                    PlatformServices.Run ();
                    System.Console.WriteLine ("Event handler stopped. WTH?");
                    PlatformServices.Shutdown (1);
                }
            }
        }