Add the given monitor object to static monitor list.
The function add the given monitor object to static monitor list.
If no name was given an exception would be thrown. But if a name was given the function check if already a monitor with this name exists in list. It must be a unique one.
The static monitor list will be used for monitors which could be used from different triggers or something else.
To see the usage of the static monitor list see the example section below.
Exception Type | Condition |
---|---|
ArgumentNullException | Thrown if no monitor, no name or no application list were given. |
Exception | The given monitor is not configured or a monitor with given name already exists in list. |
try { // Create an crash monitor which fires every time an application exits IMonitor crashMonitor = new CrashMonitor(); EventArrayList appList = new EventArrayList(); // Add crash monitor to static monitor list using a specified name Monitor.Add(crashMonitor, "myCrashTrigger", ref appList); // Sign different functions on this monitor Monitor.SignOn(new MonitorEventHandler(myCrashFunction), "myCrashMonitor"); // Start the work of all static monitors Monitor.Begin(); } catch (Exception ex) { Console.WriteLine(ex.Message); }
Monitor Class | uws.Monitors Namespace | IMonitor