public override async void Refresh() { _memberList.DisposeAllChildren(); if (Instance.Object != null) { var first = true; foreach (var group in ViewVariablesInstance.LocalPropertyList(Instance.Object, Instance.ViewVariablesManager, _robustSerializer)) { CreateMemberGroupHeader( ref first, TypeAbbreviation.Abbreviate(group.Key), _memberList); foreach (var control in group) { _memberList.AddChild(control); } } } else { DebugTools.AssertNotNull(Instance.Session); var blob = await Instance.ViewVariablesManager.RequestData <ViewVariablesBlobMembers>( Instance.Session !, new ViewVariablesRequestMembers()); var otherStyle = false; var first = true; foreach (var(groupName, groupMembers) in blob.MemberGroups) { CreateMemberGroupHeader(ref first, groupName, _memberList); foreach (var propertyData in groupMembers) { var propertyEdit = new ViewVariablesPropertyControl(_vvm, _robustSerializer); propertyEdit.SetStyle(otherStyle = !otherStyle); var editor = propertyEdit.SetProperty(propertyData); var selectorChain = new object[] { new ViewVariablesMemberSelector(propertyData.PropertyIndex) }; editor.WireNetworkSelector(Instance.Session !.SessionId, selectorChain); editor.OnValueChanged += o => { Instance.ViewVariablesManager.ModifyRemote(Instance.Session !, selectorChain, o); }; _memberList.AddChild(propertyEdit); } } } }
public override async void Refresh() { _memberList.DisposeAllChildren(); if (Instance.Object != null) { foreach (var control in ViewVariablesInstance.LocalPropertyList(Instance.Object, Instance.ViewVariablesManager, _resourceCache)) { _memberList.AddChild(control); } } else { DebugTools.AssertNotNull(Instance.Session); var blob = await Instance.ViewVariablesManager.RequestData <ViewVariablesBlobMembers>( Instance.Session !, new ViewVariablesRequestMembers()); var otherStyle = false; foreach (var propertyData in blob.Members) { var propertyEdit = new ViewVariablesPropertyControl(_vvm, _resourceCache); propertyEdit.SetStyle(otherStyle = !otherStyle); var editor = propertyEdit.SetProperty(propertyData); // TODO: should this maybe not be hardcoded? if (editor is ViewVariablesPropertyEditorReference refEditor) { refEditor.OnPressed += () => Instance.ViewVariablesManager.OpenVV( new ViewVariablesSessionRelativeSelector(Instance.Session !.SessionId, new object[] { new ViewVariablesMemberSelector(propertyData.PropertyIndex) })); } editor.OnValueChanged += o => { Instance.ViewVariablesManager.ModifyRemote(Instance.Session !, new object[] { new ViewVariablesMemberSelector(propertyData.PropertyIndex) }, o); }; _memberList.AddChild(propertyEdit); } } }
public override async void Refresh() { _memberList.DisposeAllChildren(); if (Instance.Object != null) { foreach (var control in ViewVariablesInstance.LocalPropertyList(Instance.Object, Instance.ViewVariablesManager, _resourceCache)) { _memberList.AddChild(control); } } else { DebugTools.AssertNotNull(Instance.Session); var blob = await Instance.ViewVariablesManager.RequestData <ViewVariablesBlobMembers>( Instance.Session !, new ViewVariablesRequestMembers()); var otherStyle = false; foreach (var propertyData in blob.Members) { var propertyEdit = new ViewVariablesPropertyControl(_vvm, _resourceCache); propertyEdit.SetStyle(otherStyle = !otherStyle); var editor = propertyEdit.SetProperty(propertyData); var selectorChain = new object[] { new ViewVariablesMemberSelector(propertyData.PropertyIndex) }; editor.WireNetworkSelector(Instance.Session !.SessionId, selectorChain); editor.OnValueChanged += o => { Instance.ViewVariablesManager.ModifyRemote(Instance.Session !, selectorChain, o); }; _memberList.AddChild(propertyEdit); } } }