namespace IvyBus
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;
/// The EventArgs Classes
///
///
public class IvyEventArgs : EventArgs
{
private IvyClient client;
private int id;
private string arg;
///
/// the client who raise the event
///
public IvyClient Client
{
get { return client; }
}
///
/// the id argument of the message
///
public int Id
{
get { return id; }
}
///
/// the general purpose argument of the event
///
public string Argument
{
get { return arg; }
}
///
/// Args of Ivy generated events
///
internal IvyEventArgs(IvyClient app, int id, string arg)
{
this.client = app;
this.id = id;
this.arg = arg;
}
}
public class IvyDieEventArgs : IvyEventArgs
{
/* return value for Die Event */
private bool forceExit;
///
/// should we exit
///
///
/// by default the Ivy bus will make a call to Exit
/// set this flags to false if you wan't your application to survive
///
/// true
public bool ForceExit
{
get { return forceExit; }
set { forceExit = value; }
}
///
/// Arg of the Die Event
///
internal IvyDieEventArgs(IvyClient app, int id, string arg)
: base(app, id, arg)
{
forceExit = true;
}
}
public class IvyMessageEventArgs : IvyEventArgs
{
private string[] arg_list;
///
/// retreive all the arguments
///
///
public string[] GetArguments()
{
return (string[])arg_list.Clone();
}
///
/// retreive the argument at specified index
///
///
///
public string this[int index]
{
get { return arg_list[index]; }
}
///
/// Arg for the Normal Ivy Message received
///
internal IvyMessageEventArgs(IvyClient app, int id, string[] args)
: base( app, id, null)
{
this.arg_list = args;
}
}
}