Beispiel #1
0
        public static void Main()
        {

            MultiButtonHelper mbh = new MultiButtonHelper();
            mbh.AddButtonHandler(new Buttons[] {Buttons.TopRight, Buttons.BottomRight,},
                                 new MultiButtonHelper.HandleClicks(ResetAll));

            // initialize display buffer
            _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight);
            _drawing = new Drawing(_display);

            menu = new Menu(menuFont, _display);
            menu.OnMenuItemClicked += menu_OnMenuItemClicked;
            menu.Items.Add(new MenuItem() {Title = "1 Minute", CommandArg = "1"});
            menu.Items.Add(new MenuItem() {Title = "2 Minutes", CommandArg = "2"});
            menu.Items.Add(new MenuItem() {Title = "3 Minutes", CommandArg = "3"});
            menu.Items.Add(new MenuItem() {Title = "4 Minutes", CommandArg = "4"});
            menu.Items.Add(new MenuItem() {Title = "5 Minutes", CommandArg = "5"});
            menu.Items.Add(new MenuItem() {Title = "10 Minutes", CommandArg = "10"});
            menu.Items.Add(new MenuItem() {Title = "15 Minutes", CommandArg = "15"});
            menu.Items.Add(new MenuItem() {Title = "20 Minutes", CommandArg = "20"});
            menu.Items.Add(new MenuItem() {Title = "30 Minutes", CommandArg = "30"});
            menu.Items.Add(new MenuItem() {Title = "45 Minutes", CommandArg = "45"});
            menu.Items.Add(new MenuItem() {Title = "60 Minutes", CommandArg = "60"});

            ShowMenu();
            // go to sleep; all further code should be timer-driven or event-driven
            Thread.Sleep(Timeout.Infinite);
        }
Beispiel #2
0
        public static void Main()
        {
            //make sure we are using all of the right buttons
            ButtonHelper.ButtonSetup = new Buttons[]{ Buttons.TopRight, Buttons.MiddleRight, Buttons.BottomRight };

            //get our menu font
            var font = Resources.GetFont(Resources.FontResources.NinaB);
            //get a sample image for the menu items
            var arrow = new Bitmap(Resources.GetBytes(Resources.BinaryResources.right_arrow), Bitmap.BitmapImageType.Gif);
            //new up our menu
            var menu = new AGENT.Contrib.UI.Menu(font);

            //setup our menu items
            menu.Items.Add(new MenuItem() { Title = "Hello", CommandName = "Hello", CommandArg = "World", Image = arrow });
            menu.Items.Add(new MenuItem() { Title = "World", CommandName = "World", CommandArg = "World" });
            menu.Items.Add(new MenuItem() { Title = "This is not so long", CommandName = "NotLong", CommandArg = "World", Image = arrow });
            menu.Items.Add(new MenuItem() { Title = "This text is very very long", CommandName = "Long", CommandArg = "World" });
            menu.Items.Add(new MenuItem() { Title = "Nice and short", CommandName = "Short", CommandArg = "World", Image = arrow });
            menu.Items.Add(new MenuItem() { Title = "A", CommandName = "A", CommandArg = "A" });
            menu.Items.Add(new MenuItem() { Title = "B", CommandName = "A", CommandArg = "A", Image = arrow });
            menu.Items.Add(new MenuItem() { Title = "C", CommandName = "A", CommandArg = "A" });
            menu.Items.Add(new MenuItem() { Title = "D", CommandName = "A", CommandArg = "A", Image = arrow });
            menu.Items.Add(new MenuItem() { Title = "E", CommandName = "A", CommandArg = "A" });
            menu.Items.Add(new MenuItem() { Title = "F", CommandName = "A", CommandArg = "A", Image = arrow });
            menu.Items.Add(new MenuItem() { Title = "G", CommandName = "A", CommandArg = "A" });
            menu.Items.Add(new MenuItem() { Title = "H", CommandName = "A", CommandArg = "A", Image = arrow });
            menu.Items.Add(new MenuItem() { Title = "I", CommandName = "A", CommandArg = "A" });

            //responid to item clicks
            menu.OnMenuItemClicked += menu_OnMenuItemClicked;

            //render our menu
            menu.Render();

            //done
            System.Threading.Thread.Sleep(Timeout.Infinite);
        }
Beispiel #3
0
        private static void menu_OnMenuItemClicked(Menu menu, MenuItem menuItem, DateTime time)
        {
            int duration = 0;

            if (Parse.TryParseInt(menuItem.CommandArg, out duration))
            {
                menu.OnMenuItemClicked -= menu_OnMenuItemClicked;
                menu.AutoRenderOnButtonPress = false;
                TimeSpan ts = new TimeSpan(0, duration, 0);
                countdown = new CountdownTimer(ts);
                countdown.OnCountdownTimerElapsed += countdown_OnCountdownTimerElapsed;
                countdown.Start();
                cdt.Change(0, 1000);
                ShowCountDown(null);
            }
        }