public void AddFreelancer(Freelancer freelancer)
 {
     if (freelancer != null)
     {
         freelancers?.Add(freelancer);
     }
 }
        private void Users_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                Freelancer flncer = e.NewItems[0] as Freelancer;
                foreach (var item in tasks)
                {
                    if (flncer.Skill == item.RequiredSkill)
                    {
                        flncer.Info.Add(item.Name);
                        Console.WriteLine($"Updated Flancer {flncer.Name} about info for new task");
                    }
                }
                break;

            default:
                break;
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            LinkedList <Task> tasks = new LinkedList <Task>();

            tasks.AddLast(new Task("Create QT App", "C++"));
            tasks.AddLast(new Task("Create Parser", "C#"));
            ObservableCollection <Freelancer> freelancers = new ObservableCollection <Freelancer>();
            FreeLanceJobs freeLanceJobs = new FreeLanceJobs(tasks, freelancers);

            Console.WriteLine("Test");
            Freelancer oleg = new Freelancer("Oleg", 22, "C#");

            freeLanceJobs.AddFreelancer(oleg);
            freeLanceJobs.AddFreelancer(new Freelancer("Boris", 44, "Assembler"));
            Console.WriteLine($"Oleg Info : ");
            foreach (var item in oleg.Info)
            {
                Console.WriteLine(item);
            }
        }