Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
pluginbase.Objects.Libs.Events.ManagedEvent< TDelegate > Class Template Reference

Public Member Functions

 ManagedEvent ()
 
 ManagedEvent (bool throws=false, bool removeOnError=true)
 
void Clear ()
 
void Add (TDelegate dlg)
 
void Remove (TDelegate dlg)
 
int Invoke (Action< TDelegate > invoker)
 

Properties

int Count [get]
 

Constructor & Destructor Documentation

pluginbase.Objects.Libs.Events.ManagedEvent< TDelegate >.ManagedEvent ( )
30  {}
pluginbase.Objects.Libs.Events.ManagedEvent< TDelegate >.ManagedEvent ( bool  throws = false,
bool  removeOnError = true 
)
33  {
34  _throws = throws;
35  _removeOnError = removeOnError;
36  }

Member Function Documentation

void pluginbase.Objects.Libs.Events.ManagedEvent< TDelegate >.Add ( TDelegate  dlg)
45  {
46  lock (_lock)
47  {
48  _invokes.Add(dlg);
49  }
50  }
void pluginbase.Objects.Libs.Events.ManagedEvent< TDelegate >.Clear ( )
39  {
40  lock (_lock)
41  _invokes.Clear();
42  }
void Clear()
Definition: ManagedEvent.cs:38
int pluginbase.Objects.Libs.Events.ManagedEvent< TDelegate >.Invoke ( Action< TDelegate >  invoker)

Attribute: i

);

61  {
62  int invoked = 0;
63  lock(_lock)
64  {
65  for (int i=_invokes.Count-1; i>=0; --i)
66  {
67  try
68  {
69  invoker(_invokes[i]);
70  invoked++;
71  }
72  catch(ObjectDisposedException)
73  {
74  _invokes.RemoveAt(i);
75  }
76  catch(Exception)
77  {
78  if (_throws)
79  throw;
80  if (_removeOnError)
81  _invokes.RemoveAt(i);
82  }
83  }
84  }
85  return invoked;
86  }
void pluginbase.Objects.Libs.Events.ManagedEvent< TDelegate >.Remove ( TDelegate  dlg)
53  {
54  lock (_lock)
55  {
56  _invokes.Remove(dlg);
57  }
58  }

Property Documentation

int pluginbase.Objects.Libs.Events.ManagedEvent< TDelegate >.Count
get

The documentation for this class was generated from the following file: