internal sealed override void WriteChanges(EmberWriter writer, IInvocationCollection pendingInvocations) { if (this.HasChanges) { writer.WriteStartApplicationDefinedType( GlowElementCollection.Element.OuterId, GlowQualifiedMatrix.InnerNumber); writer.WriteValue(GlowQualifiedMatrix.Path.OuterId, this.NumberPath); writer.WriteStartSequence(GlowQualifiedMatrix.Connections.OuterId); foreach (var target in this.targetsWithChangedConnections) { writer.WriteStartApplicationDefinedType( GlowConnectionCollection.Connection.OuterId, GlowConnection.InnerNumber); writer.WriteValue(GlowConnection.Target.OuterId, target); writer.WriteValue(GlowConnection.Sources.OuterId, this.connections[target].ToArray()); writer.WriteEndContainer(); } writer.WriteEndContainer(); writer.WriteEndContainer(); this.targetsWithChangedConnections.Clear(); this.HasChanges = false; } }
private void WriteInvocations(EmberWriter writer, IInvocationCollection pendingInvocations) { while (this.invocations.Count > 0) { writer.WriteStartApplicationDefinedType(GlowElementCollection.Element.OuterId, GlowCommand.InnerNumber); writer.WriteValue(GlowCommand.Number.OuterId, 33); writer.WriteStartApplicationDefinedType(GlowCommand.Invocation.OuterId, GlowInvocation.InnerNumber); var invocation = this.invocations.Dequeue(); var invocationId = pendingInvocations.Add(invocation.Key); writer.WriteValue(GlowInvocation.InvocationId.OuterId, invocationId); writer.WriteStartSequence(GlowInvocation.Arguments.OuterId); foreach (var writeValue in invocation.Value) { writeValue(writer); } writer.WriteEndContainer(); writer.WriteEndContainer(); writer.WriteEndContainer(); } }