Ejemplo n.º 1
0
        private void showTimeMenuItem_Select(OperationMenuItem i_CurrentOperation)
        {
            Console.Clear();
            string timeToPrint = DateTime.Now.ToShortTimeString();

            Console.WriteLine(timeToPrint);
            Show();
        }
Ejemplo n.º 2
0
        private List <MenuItem> createActionsMenusItems()
        {
            List <MenuItem> listOfMenus = new List <MenuItem>();

            OperationMenuItem countSpaces = new OperationMenuItem(k_CountSpacesMenuName);

            countSpaces.Selected += countSpacesMenuItem_Select;
            listOfMenus.Add(countSpaces);

            OperationMenuItem charCount = new OperationMenuItem(k_CharCountMenuName);

            charCount.Selected += charCountMenuItem_Select;
            listOfMenus.Add(charCount);

            return(listOfMenus);
        }
Ejemplo n.º 3
0
        private List <MenuItem> createActionsAndInfoMenusItems()
        {
            List <MenuItem> listOfMenus = new List <MenuItem>();

            OperationMenuItem displayMenuItem = new OperationMenuItem(k_DisplayVersionMenuName);

            displayMenuItem.Selected += showVersionMenuItem_Select;
            listOfMenus.Add(displayMenuItem);

            List <MenuItem> actionsMenusItems = createActionsMenusItems();
            MainMenu        actions           = new MainMenu(k_ActionsMenuName, actionsMenusItems);

            listOfMenus.Add(actions);

            return(listOfMenus);
        }
Ejemplo n.º 4
0
        private List <MenuItem> createDateAndTimeMenusItems()
        {
            List <MenuItem> listOfMenus = new List <MenuItem>();

            OperationMenuItem showDateMenuItem = new OperationMenuItem(k_ShowDateMenuName);

            showDateMenuItem.Selected += showDateMenuItem_Select;
            listOfMenus.Add(showDateMenuItem);

            OperationMenuItem showTimeMenuItem = new OperationMenuItem(k_ShowTimeMenuName);

            showTimeMenuItem.Selected += showTimeMenuItem_Select;
            listOfMenus.Add(showTimeMenuItem);

            return(listOfMenus);
        }
Ejemplo n.º 5
0
        private List <MenuItem> createActionsMenusItems()
        {
            List <MenuItem> listOfMenus = new List <MenuItem>();

            OperationMenuItem countSpaces = new OperationMenuItem(k_CountSpacesMenuName);

            countSpaces.ActionListener = this;
            listOfMenus.Add(countSpaces);

            OperationMenuItem charCount = new OperationMenuItem(k_CharCountMenuName);

            charCount.ActionListener = this;
            listOfMenus.Add(charCount);

            return(listOfMenus);
        }
Ejemplo n.º 6
0
        private List <MenuItem> createDateAndTimeMenusItems()
        {
            List <MenuItem> listOfMenus = new List <MenuItem>();

            OperationMenuItem showDateMenuItem = new OperationMenuItem(k_ShowDateMenuName);

            showDateMenuItem.ActionListener = this;
            listOfMenus.Add(showDateMenuItem);

            OperationMenuItem showTimeMenuItem = new OperationMenuItem(k_ShowTimeMenuName);

            showTimeMenuItem.ActionListener = this;
            listOfMenus.Add(showTimeMenuItem);

            return(listOfMenus);
        }
Ejemplo n.º 7
0
        private void charCountMenuItem_Select(OperationMenuItem i_CurrentOperation)
        {
            Console.Clear();
            Console.WriteLine("Please enter a sentence");
            string sentence         = Console.ReadLine();
            int    counterOfLetters = 0;

            foreach (char character in sentence)
            {
                if (char.IsLetter(character))
                {
                    counterOfLetters++;
                }
            }

            Console.WriteLine(string.Format("There is {0} letters in the string.", counterOfLetters));

            Show();
        }
Ejemplo n.º 8
0
 private void showVersionMenuItem_Select(OperationMenuItem i_CurrentOperation)
 {
     Console.Clear();
     Console.WriteLine(k_AppVersion);
     Show();
 }