Пример #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));
        }
Пример #2
0
        public void DisplayFullList(IListNote note)
        {
            displayFullInfoHeader(note);
            displayFullInfoContent(note);
            displayAdditionalInfoContent(note);

            Console.ForegroundColor = DEFAULT_COLOR;
        }
Пример #3
0
        private void displayAdditionalInfoContent(IListNote note)
        {
            List <string> noteAdditionlContent = note.GetAdditionalContent();

            for (int i = 0; i < noteAdditionlContent.Count; i++)
            {
                Console.WriteLine(noteAdditionlContent[i]);
            }
        }
Пример #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));
        }
Пример #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);
            }
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
         }
     }
 }