Beispiel #1
0
        void NotifyClients(EventItem item)
        {
            if (ChangedEvent != null)
            {
                Delegate[] delagates = ChangedEvent.GetInvocationList();

                foreach (ChangeEventHandler del in delagates)
                {
                    new Thread(() => {
                        try
                        {
                            del(item);
                            Console.WriteLine("Invoking event handler");
                        }
                        catch (Exception e)
                        {
                            ChangedEvent -= del;
                            Console.WriteLine("Exception: Removed an event handler");
                            Console.WriteLine("Exception: " + e.Message);
                        }
                    }).Start();
                }
            }
        }