static void Main(string[] args) { int origWidth = Console.WindowWidth * 2; int origHeight = Console.WindowHeight * 2; Console.SetWindowSize(origWidth, origHeight); MyNewCollection firstList = new MyNewCollection("Первая коллекция", 5); MyNewCollection secondList = new MyNewCollection("Вторая коллекция", 5); Journal firstJournal = new Journal(); firstList.CollectionCountChanged += new CollectionHandler(firstJournal.CollectionCountChanged); //+=firstJournal.CollectionCountChanged firstList.CollectionReferenceChanged += new CollectionHandler(firstJournal.CollectionReferenceChanged); Journal secondJournal = new Journal(); firstList.CollectionReferenceChanged += new CollectionHandler(secondJournal.CollectionReferenceChanged); secondList.CollectionReferenceChanged += new CollectionHandler(secondJournal.CollectionReferenceChanged); firstList.Add(); firstList.Add(); secondList.Add(); firstList.Remove(2); secondList.Remove(2); firstList[2] = new InsuranceCompany("Страховая компания1", "Город1", 150, 1000000, "Регион1"); secondList[3] = Organization.RandomOrganization(); firstList[3] = new InsuranceCompany("Страховая компания2", "Город2", 100, 5000000, "Регион2"); Console.WriteLine("=== Первый журнал: ==="); Console.WriteLine(firstJournal); Console.WriteLine(); Console.WriteLine("=== Второй журнал: ==="); Console.WriteLine(secondJournal); Console.ReadLine(); }
public static void Main(string[] args) { var col1 = new MyNewCollection("FirstCol", 10); var col2 = new MyNewCollection("SecondCol", 10); var journal1 = new Journal(); col1.CollectionCountChanged += journal1.OnCollectionCountChanged; col1.CollectionReferenceChanged += journal1.OnCollectionReferenceChanged; var journal2 = new Journal(); col1.CollectionReferenceChanged += journal2.OnCollectionReferenceChanged; col2.CollectionReferenceChanged += journal2.OnCollectionReferenceChanged; col1[5] = (Food) new Food().CreateRandom(); col1.Remove(5); col1.AddRandom(); Console.WriteLine(journal1); col2.Add((Food) new Food().CreateRandom()); col2[0] = (Food) new Food().CreateRandom(); Console.WriteLine(journal2); }