public DataChangedEventArgs(OrganizerEvent data, IEventDataContainer dataSource)
 {
     this.Data = data;
     this.DataSource = dataSource;
 }
 public DataChangedEventArgs(IEventDataContainer dataSource)
     : this(null, dataSource)
 {
 }
 private void UnSubscribeFromDataSourceEvents(IEventDataContainer dataSource)
 {
     dataSource.EventAdded -= new EventHandler(EventAdded);
     dataSource.EventRemoved -= new EventHandler(EventRemoved);
     dataSource.DataRefreshed -= new EventHandler(DataRefreshed);
 }
 private void SubscribeToDataSourceEvents(IEventDataContainer dataSource)
 {
     if (dataSource != null)
     {
         dataSource.EventAdded += new EventHandler(EventAdded);
         dataSource.EventRemoved += new EventHandler(EventRemoved);
         dataSource.DataRefreshed += new EventHandler(DataRefreshed);
     }
 }
        public void DetachDataSource(IEventDataContainer dataSource)
        {
            if (dataSource == null)
            {
                throw new NullDataSourceException();
            }
            if(!this.dataSources.Contains(dataSource))
            {
                throw new DataSourceException();
            }

            this.dataSources.Remove(dataSource);
            this.UnSubscribeFromDataSourceEvents(dataSource);
        }
        public void AtachDataSource(IEventDataContainer dataSource)
        {
            if (dataSource == null)
            {
                throw new NullDataSourceException();
            }
            if(this.dataSources.Contains(dataSource))
            {
                throw new DuplicateDataSourceException();
            }

            this.dataSources.Add(dataSource);
            this.SubscribeToDataSourceEvents(dataSource);
        }