WX5.ObjectManager Class Reference

Provides links between objects. More...

List of all members.

Public Member Functions

 ObjectManager ()
 Initializes the constructed ObjectManager object.
ObjectManager Bind (object target, string targetMember, object source, string sourceMember, bool isSourceUpdatable)
 Binds the source member with the target member

            // This call will create the bidirectional realtionship between the listbox and myState object
            objManager.Bind(myListBox, "SelectedIndex", myState, "_currentId", true);

ObjectManager Bind (object target, string targetMember, object source, string sourceMember)
 Binds the source member with the target member The source is not updateable.
ObjectManager Bind (object target, BlockX< object > source)
 Binds the target member with the block of code.
ObjectManager UpdateTargets ()
 Updates all targets.
ObjectManager UpdateSources ()
 Updates all updateable sources.

Static Public Member Functions

static ObjectManager NewObjectManager ()
 Returns new instance of ObjectManager.

Detailed Description

Provides links between objects.

        // Example
        class A {
          private int _id;
          public int getId(){return _id;}
          public void setId(int x){ _id = x; }
        }
        class B {public int ID;}
        class C {
          public static void Main() {
            WX5.ObjectManager m = new WX5.ObjectManager();
            A a = new A(); B b = new B();
            m.Bind(a, "_id", b, "ID", true);
            b.ID = 5;
            m.UpdateTargets();
            bool result = a.getId() == b.ID;
            a.setId(-1);
            m.UpdateSources();
            bool result2 = a.getId() == b.ID;
          }
        }

Constructor & Destructor Documentation

WX5.ObjectManager.ObjectManager (  ) 

Initializes the constructed ObjectManager object.


Member Function Documentation

ObjectManager WX5.ObjectManager.Bind ( object  target,
BlockX< object >  source 
)

Binds the target member with the block of code.

Parameters:
target target object
source a code to update
Returns:
current ObjectManager instance
ObjectManager WX5.ObjectManager.Bind ( object  target,
string  targetMember,
object  source,
string  sourceMember 
)

Binds the source member with the target member The source is not updateable.

Parameters:
target target object
targetMember target member: field or property
source source object
sourceMember source member: field or property
Returns:
current ObjectManager instance
ObjectManager WX5.ObjectManager.Bind ( object  target,
string  targetMember,
object  source,
string  sourceMember,
bool  isSourceUpdatable 
)

Binds the source member with the target member

            // This call will create the bidirectional realtionship between the listbox and myState object
            objManager.Bind(myListBox, "SelectedIndex", myState, "_currentId", true);

Parameters:
target target object
targetMember target member: field or property
source source object
sourceMember source member: field or property
isSourceUpdatable True if source object can be updated using target object
Returns:
current ObjectManager instance
static ObjectManager WX5.ObjectManager.NewObjectManager (  )  [static]

Returns new instance of ObjectManager.

Returns:
new instance of ObjectManager
ObjectManager WX5.ObjectManager.UpdateSources (  ) 

Updates all updateable sources.

Returns:
ObjectManager WX5.ObjectManager.UpdateTargets (  ) 

Updates all targets.

Returns:
Generated on Wed Jun 2 01:15:47 2010 for WX Library 5.0 documentation by  doxygen 1.6.3