/*****************************************************************************
* *
* HID USB DRIVER - FLORIAN LEITNER *
* Copyright 2007 - Florian Leitner | http://www.florian-leitner.de *
* mail@florian-leitner.de *
* *
* This file is part of HID USB DRIVER. *
* *
* HID USB DRIVER is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License 3.0 as published by *
* the Free Software Foundation; *
* HID USB DRIVER is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see . *
* *
******************************************************************************/
//---------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace USBHIDDRIVER.List
{
///
/// A class that works just like ArrayList, but sends event
/// notifications whenever the list changes
///
public class ListWithEvent : System.Collections.ArrayList
{
///
/// An event that clients can use to be notified whenever the
/// elements of the list change
///
public event System.EventHandler Changed;
///
/// Invoke the Changed event; called whenever list changes
///
/// The instance containing the event data.
protected virtual void OnChanged(System.EventArgs e)
{
if (Changed != null)
{
Changed(this, e);
}
}
// Override some of the methods that can change the list;
// invoke event after each:
///
/// Fügt am Ende von ein Objekt hinzu.
///
/// Das , das am Ende der hinzugefügt werden soll. Der Wert kann null sein.
///
/// Der -Index, an dem value hinzugefügt wurde.
///
/// ist schreibgeschützt.- oder - hat eine feste Größe.
public override int Add(object value)
{
int i = base.Add(value);
OnChanged(System.EventArgs.Empty);
return i;
}
}
}