C# Class SIL.FieldWorks.SharpViews.Hookups.TssHookupAdapter

The information a TssHookup needs in order to hook to a particular string property of a particular object. This is intended to support one style of view construction with SharpViews. The idea is that, given a class like StTxtPara and a property like Contents, we could generate a helper class StTxtParaProps, with static methods like this: class StTxtParaProps { public static TssHookupAdapter Contents(StTxtPara target) { return new TssHookupAdapter(target, () => target.Contents, hookup => target.Contents += hookup.TssPropChanged, hookup => target.Contents -= hookup.TssPropChanged); } } This then allows us to do something (as yet not fully designed or implemented) like aView.Add(StTxtParaProps.Contents(aPara)); Problems: (1) the above doesn't look particularly fluent; (2) we have a dependency problem between SharpViews (which defines TssHookupAdapter) and FDO (where we'd like to keep the model-specific code generation). SharpViews already references FDO, and it's unlikely we can change that. The approach used in ExpressionDemo may be more promising.
Inheritance: HookupAdapter
Show file Open project: sillsdev/FieldWorks Class Usage Examples

Public Methods

Method Description
TssHookupAdapter ( object target, Func reader, Action addHook, Action removeHook ) : System

Method Details

TssHookupAdapter() public method

public TssHookupAdapter ( object target, Func reader, Action addHook, Action removeHook ) : System
target object
reader Func
addHook Action
removeHook Action
return System