/// <summary> /// Returns a representation of the current parameter state of the tree /// </summary> private void EmberTreeInitialState() { Dictionary <string, dynamic> obj = new Dictionary <string, dynamic>(); foreach (ParameterBase parameter in _emberTree.GetChildParameterElements()) { log.Debug(parameter.IdentifierPath, parameter.GetValue().ToString()); obj.Add(parameter.IdentifierPath, new { Value = parameter.GetValue(), NumericPath = string.Join(".", parameter.Path) }); } _websocketHub.Clients.All.RawEmberTree(obj); }
/// <summary> /// Returns a representation of the current parameter state of the tree /// </summary> private void EmberTreeInitialState() { // Send out the regular nodes/parameters from the tree Dictionary <string, ClientTreeParameterViewModel> tree = new Dictionary <string, ClientTreeParameterViewModel>(); foreach (ParameterBase parameter in _emberTree.GetChildParameterElements()) { log.Debug(parameter.IdentifierPath, parameter.GetValue().ToString()); tree.Add(parameter.IdentifierPath, new ClientTreeParameterViewModel() { Type = parameter.GetType().ToString(), Value = parameter.GetValue(), NumericPath = string.Join(".", parameter.Path), IsWritable = parameter.IsWritable, Options = new { } }); } _websocketHub.Clients.All.InitialEmberTree(tree); // Send out the matrices in the tree Dictionary <string, ClientMatrixViewModel> matrices = new Dictionary <string, ClientMatrixViewModel>(); foreach (Matrix treeMatrix in _emberTree.GetChildMatrixElements()) { ClientMatrixViewModel matrix = new ClientMatrixViewModel() { Name = treeMatrix.Parent.Parent.Identifier + " " + treeMatrix.Parent.Identifier, NumericPath = string.Join(".", treeMatrix.Path) }; foreach (var target in treeMatrix.Targets) { var item = new ClientMatrixSignalViewModel() { Index = target.Number, Name = target.LabelParameter.Value, LabelPath = target.LabelParameter.IdentifierPath, ConnectedSources = target.ConnectedSources.Select((x) => x.Number).ToArray() }; matrix.Targets.Add(item); } foreach (var source in treeMatrix.Sources) { var item = new ClientMatrixSignalViewModel() { Index = source.Number, Name = source.LabelParameter.Value }; matrix.Sources.Add(item); } matrices.Add(treeMatrix.IdentifierPath, matrix); } _websocketHub.Clients.All.InitialEmberTreeMatrix(matrices); }