Class View
Inheritance
System.Object
View
Assembly: Eco.Shared.dll
Syntax
public class View : Object, IView, IViewController, IObservable
Constructors
View(View.ViewData)
Declaration
protected View(View.ViewData data)
Parameters
Fields
AutoSubscribeKey
Declaration
public const string AutoSubscribeKey = "a"
Field Value
Type |
Description |
System.String |
|
Data
Declaration
protected readonly View.ViewData Data
Field Value
DescribeView
Declaration
public static Func<View, string> DescribeView
Field Value
Type |
Description |
System.Func<View, System.String> |
|
IDKey
Declaration
public const string IDKey = "k"
Field Value
Type |
Description |
System.String |
|
NameKey
Declaration
public const string NameKey = "n"
Field Value
Type |
Description |
System.String |
|
PropertiesKey
Declaration
public const string PropertiesKey = "p"
Field Value
Type |
Description |
System.String |
|
SyncedViewRPCName
Declaration
public const string SyncedViewRPCName = "SyncedViewRPC"
Field Value
Type |
Description |
System.String |
|
TypeKey
Declaration
public const string TypeKey = "t"
Field Value
Type |
Description |
System.String |
|
ValueKey
Declaration
public const string ValueKey = "v"
Field Value
Type |
Description |
System.String |
|
ViewRPCName
Declaration
public const string ViewRPCName = "ViewRPC"
Field Value
Type |
Description |
System.String |
|
Properties
ClassInfo
Declaration
public ViewClassInfo ClassInfo { get; }
Property Value
ControllerID
Declaration
public int ControllerID { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
DebugName
Returns View name which may be used for debugging.
Declaration
public string DebugName { get; }
Property Value
Type |
Description |
System.String |
|
TypeName
Declaration
public string TypeName { get; }
Property Value
Type |
Description |
System.String |
|
ViewTypeID
Declaration
public int ViewTypeID { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Methods
DescribeSubscriptions(StringBuilder, String)
Returns count of property subscriptions. Mostly for debugging purposes.
Declaration
public void DescribeSubscriptions(StringBuilder sb, string propertyName)
Parameters
Type |
Name |
Description |
System.Text.StringBuilder |
sb |
|
System.String |
propertyName |
|
GetOrRecoverView(View.ViewData)
Exposes access to Eco.Shared.View.ViewManager.GetOrRecoverView(Eco.Shared.View.View.ViewData) from View derived classes.
Declaration
protected View GetOrRecoverView(View.ViewData viewData)
Parameters
Returns
GetValue(String, Int32)
Declaration
public object GetValue(string propName, int listIndex = -1)
Parameters
Type |
Name |
Description |
System.String |
propName |
|
System.Int32 |
listIndex |
|
Returns
Type |
Description |
System.Object |
|
HasData(View.ViewData)
Checks if view is holding data
.
Declaration
public bool HasData(View.ViewData data)
Parameters
Returns
Type |
Description |
System.Boolean |
|
HasProperty(String)
Declaration
public bool HasProperty(string propertyName)
Parameters
Type |
Name |
Description |
System.String |
propertyName |
|
Returns
Type |
Description |
System.Boolean |
|
Initialize()
Declaration
public virtual void Initialize()
IsAvailable(ViewMemberInfo)
Check if a property is available (that is, if it needs requesting it has been received).
Declaration
public bool IsAvailable(ViewMemberInfo member)
Parameters
Returns
Type |
Description |
System.Boolean |
|
IsAvailable(String)
Check if a property is available (that is, if it needs requesting it has been received).
Declaration
public bool IsAvailable(string propname)
Parameters
Type |
Name |
Description |
System.String |
propname |
|
Returns
Type |
Description |
System.Boolean |
|
ManualRPC(String, Int32, Object[])
Declaration
public static void ManualRPC(string methodname, int viewId, params object[] args)
Parameters
Type |
Name |
Description |
System.String |
methodname |
|
System.Int32 |
viewId |
|
System.Object[] |
args |
|
ManualRPC<T>(String, Action<T>, Int32, Object[])
Makes RPC call on view with provided viewId
.
Declaration
public static void ManualRPC<T>(string methodname, Action<T> response, int viewId, params object[] args)
Parameters
Type |
Name |
Description |
System.String |
methodname |
|
System.Action<T> |
response |
|
System.Int32 |
viewId |
|
System.Object[] |
args |
|
Type Parameters
NotifyAll()
Notifies all changed callbacks for all properties. Primarily intended for debugging.
Declaration
NotifyChanged(String)
Declaration
public virtual void NotifyChanged(string propertyName)
Parameters
Type |
Name |
Description |
System.String |
propertyName |
|
Recover()
Recovers View from Data.
When original View was destroyed, but then a reference to it received from the server then it may need to perform some logic to correctly restore View from backup Data.
Declaration
protected virtual void Recover()
RPC(String, Action, Object[])
Makes RPC call on the View with callback with no return value. response
callback doesn't wait while views changed with RPC synced back to the client, so you may have old View values when callback invoke. If you need to have synced values then use SyncedRPC(String, Action, Object[]) instead.
Declaration
public void RPC(string methodname, Action response, params object[] args)
Parameters
Type |
Name |
Description |
System.String |
methodname |
|
System.Action |
response |
|
System.Object[] |
args |
|
RPC(String, Object[])
Makes RPC call on the View.
Declaration
public void RPC(string methodname, params object[] args)
Parameters
Type |
Name |
Description |
System.String |
methodname |
|
System.Object[] |
args |
|
RPC<T>(String, Action<T>, Object[])
Makes RPC call on the View with callback having return value. response
callback doesn't wait while views changed with RPC synced back to the client, so you may have old View values when callback invoke. If you need to have synced values then use SyncedRPC<T>(String, Action<T>, Object[]) instead.
Declaration
public void RPC<T>(string methodname, Action<T> response, params object[] args)
Parameters
Type |
Name |
Description |
System.String |
methodname |
|
System.Action<T> |
response |
|
System.Object[] |
args |
|
Type Parameters
SetFieldViewData<T>(out T, View)
Sets field
's View.ViewData from view
. We need this method because of accessibility restrictions.
Declaration
protected void SetFieldViewData<T>(out T field, View view)
where T : View.ViewData
Parameters
Type |
Name |
Description |
T |
field |
|
View |
view |
|
Type Parameters
Subscribe(IPropertySubscription)
Declaration
public void Subscribe(IPropertySubscription subscription)
Parameters
SubscribeUnique(IPropertySubscription)
Declaration
public bool SubscribeUnique(IPropertySubscription subscription)
Parameters
Returns
Type |
Description |
System.Boolean |
|
SyncedRPC(String, Action, Object[])
Makes RPC call on the View with callback with no return value. Callback will be synced with view updates initiated by RPC. I.e. if it changes a property then that property will be synced back to the client before callback invoked.
Should be used when RPC callback expects view changes to be synced on the client. I.e. after SetProperty you want to make some calculations based on value of that property.
view.RPC("SetDateOfBirth", () => age = DateTime.Today - view.DateOfBirth, date);
When non-synced RPC
used there no guarantee that DateOfBirth will have new value just set with RPC, because it synced asynchronously to RPC. It may still have old value (actually in most cases it will have previous value).
Declaration
public void SyncedRPC(string methodname, Action response, params object[] args)
Parameters
Type |
Name |
Description |
System.String |
methodname |
|
System.Action |
response |
|
System.Object[] |
args |
|
SyncedRPC<T>(String, Action<T>, Object[])
Makes RPC call on the View with callback having return value. Callback will be synced with view updates initiated by RPC. I.e. if it changes a property then that property will be synced back to the client before callback invoked.
See SyncedRPC(String, Action, Object[]) for more details and examples.
Declaration
public void SyncedRPC<T>(string methodname, Action<T> response, params object[] args)
Parameters
Type |
Name |
Description |
System.String |
methodname |
|
System.Action<T> |
response |
|
System.Object[] |
args |
|
Type Parameters
ThrottledRPC(String, Object[])
Makes RPC call on the View with ensurence that it won't be sent again if server still didn't confirmed previous request.
Declaration
public void ThrottledRPC(string methodname, params object[] args)
Parameters
Type |
Name |
Description |
System.String |
methodname |
|
System.Object[] |
args |
|
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
TryGetValue<T>(String, out T, Int32)
Get a dynamic value by property name, querying both reflection and the list of dynamic properties sent by the server. Returns
false if the property doesnt exist in either, or if referencing a list, the list index doesn't exist.
Declaration
public bool TryGetValue<T>(string propName, out T retVal, int listIndex = -1)
Parameters
Type |
Name |
Description |
System.String |
propName |
|
T |
retVal |
|
System.Int32 |
listIndex |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
Unsubscribe(IPropertySubscription)
Removes subscription
from Eco.Shared.View.View.changedCallbacks.
Declaration
public void Unsubscribe(IPropertySubscription subscription)
Parameters
UpdateProperty(BSONValue, BSONObject)
Declaration
public void UpdateProperty(BSONValue propNameID, BSONObject bson)
Parameters
VerifyPropReceived(String)
Declaration
protected void VerifyPropReceived(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Implements
Extension Methods