Пример #1
0
        //Executes an action when a menu button is pressed.
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.theme:
                colorIndex++;           //Goes through all the available background colors
                if (colorIndex == 4)
                {
                    colorIndex = 0;
                }
                switch (colorIndex)
                {
                case 0:
                    changeColor("blue");         //sends the chosen background color to the function changecolor.
                    break;

                case 1:
                    changeColor("yellow");
                    break;

                case 2:
                    changeColor("green");
                    break;

                case 3:
                    changeColor("orange");
                    break;
                }
                return(true);

            case Resource.Id.exit:
                //Force quit the application.
                System.Environment.Exit(0);
                return(true);

            case Resource.Id.abort:

                //Stop threads forcibly (for debugging only).
                if (connector != null)
                {
                    if (connector.CheckStarted())
                    {
                        connector.Abort();
                    }
                }
                return(true);
            }
            return(base.OnOptionsItemSelected(item));
        }
Пример #2
0
        //Executes an action when a menu button is pressed.
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.exit:
                //Force quit the application.
                System.Environment.Exit(0);
                return(true);

            case Resource.Id.abort:

                //Stop threads forcibly (for debugging only).
                if (connector != null)
                {
                    if (connector.CheckStarted())
                    {
                        connector.Abort();
                    }
                }
                return(true);
            }
            return(base.OnOptionsItemSelected(item));
        }