Exemplo n.º 1
0
        private void initSingleListItemFromComponent(string[] components, IListNote note)
        {
            string        content     = components[0];
            bool          highlighted = bool.Parse(components[1]);
            ItemsModifier modifier    = new ItemsModifier();

            modifier.TryAddToList(note, new ListItem(highlighted, content));
        }
Exemplo n.º 2
0
        public void DisplayFullList(IListNote note)
        {
            displayFullInfoHeader(note);
            displayFullInfoContent(note);
            displayAdditionalInfoContent(note);

            Console.ForegroundColor = DEFAULT_COLOR;
        }
Exemplo n.º 3
0
        private void displayAdditionalInfoContent(IListNote note)
        {
            List <string> noteAdditionlContent = note.GetAdditionalContent();

            for (int i = 0; i < noteAdditionlContent.Count; i++)
            {
                Console.WriteLine(noteAdditionlContent[i]);
            }
        }
Exemplo n.º 4
0
        private void handleAddingItem(IListNote note)
        {
            Console.WriteLine("Type item content");
            string content = Console.ReadLine();

            Console.WriteLine("Is checked? (Y/n)");
            bool          isChecked = Console.ReadLine() == "n" ? false : true;
            ItemsModifier modifier  = new ItemsModifier();

            modifier.TryAddToList(note, new ListItem(isChecked, content));
        }
Exemplo n.º 5
0
        public void BuildListItems(IListNote note)
        {
            Console.WriteLine("Type count of items in list:");
            int count;

            int.TryParse(Console.ReadLine(), out count);
            for (int i = 0; i < count; i++)
            {
                handleAddingItem(note);
            }
        }
Exemplo n.º 6
0
        public bool TryAddToList(IListNote note, ListItem item)
        {
            if (note.Items.Contains(item))
            {
                Logger.PrintError($"Item: {item} (Content = {item.Content}, Highlighted = {item.Checked}) already exists");
                return(false);
            }

            note.Items.Add(item);
            return(true);
        }
Exemplo n.º 7
0
        public bool TryRemoveFromList(IListNote note, ListItem item)
        {
            if (!note.Items.Contains(item))
            {
                Logger.PrintError($"Item: {item} (Content = {item.Content}, Highlighted = {item.Checked}) does not exist");
                return(false);
            }

            note.Items.Remove(item);
            return(true);
        }
Exemplo n.º 8
0
 public void InitListItemsFromComponents(string[] components, int lastStandardIndex, IListNote source)
 {
     for (int i = lastStandardIndex + 1; i < components.Length; i += ListItem.SAVE_COMPONENTS_COUNT)
     {
         try
         {
             initSingleListItemFromComponent(components, source);
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
         }
     }
 }