public bool Remove(int j)
        {
            if (ListOfCopywriters == null)
            {
                Console.WriteLine("The list is empty ");
            }

            if (ListOfCopywriters[j] == null)
            {
                return(false);
            }
            else
            {
                if (CopywriterCountChanged != null)
                {
                    CopywriterListHandlerEventArgs e = new CopywriterListHandlerEventArgs(CopywriterCollectionName, " An element was removed from the collection  ", ListOfCopywriters[j]);
                    CopywriterCountChanged(this, e);
                }
                ListOfCopywriters.RemoveAt(j);
                for (int i = j; i < ListOfCopywriters.Count - 1; i++)
                {
                    ListOfCopywriters[i] = ListOfCopywriters[i + 1];
                }

                return(true);
            }
        }
예제 #2
0
 public void CopywriterReferenceChanged(object source, CopywriterListHandlerEventArgs e)
 {
     if (JournalEntryList == null)
     {
         JournalEntryList = new List <JournalEntry>();
     }
     JournalEntryList.Add(new JournalEntry(e));
     Console.WriteLine(e.CollectionChangesTypeInfo);
 }
 public void AddCopywriters(params Copywriter[] array)
 {
     if (ListOfCopywriters == null)
     {
         ListOfCopywriters = new List <Copywriter>();
     }
     ListOfCopywriters.AddRange(array);
     if (CopywriterCountChanged != null)
     {
         CopywriterListHandlerEventArgs e = new CopywriterListHandlerEventArgs(CopywriterCollectionName, " A new elements were added to the collection  ", ListOfCopywriters[ListOfCopywriters.Count - array.Length]);
         CopywriterCountChanged(this, e);
     }
 }
        public void AddDefaults()
        {
            if (ListOfCopywriters == null)
            {
                ListOfCopywriters = new List <Copywriter>();
            }
            Copywriter copywriter = new Copywriter();

            ListOfCopywriters.Add(copywriter);

            if (CopywriterCountChanged != null)
            {
                CopywriterListHandlerEventArgs e = new CopywriterListHandlerEventArgs(CopywriterCollectionName, " A default element was added to the collection  ", copywriter);
                CopywriterCountChanged(this, e);
            }
        }
예제 #5
0
 public JournalEntry(CopywriterListHandlerEventArgs e)
 {
     CopywriterCollectionNameWithChanges = e.CollectionWithChangesName;
     CollectionChangesTypeInfo           = e.CollectionChangesTypeInfo;
     CopywriterInfo = e.ReferenceProperty.Nickname;
 }