void handleInitialSetupComplete(Message.InitialSetupComplete initialSetupComplete) { if (_initialSetupComplete || initialSetupComplete.handshake.authToken != _handshake.authToken) { return; } foreach (InitialSetupCompleteDelegate listener in _initialSetupCompleteListeners) { listener(); } _initialSetupComplete = true; }
public void notifyOnReady() { if (_handshake.authToken == null) { _pendingOnReady = true; // once everything is ready, we request a handshake from the viewer. requestHandshake(); } else { string onReadyJsonString = SimCapiJsonMaker.create_ON_READY(_handshake); sendMessage(onReadyJsonString); _pendingOnReady = false; foreach (HandshakeDelegate handshakeDelegate in _handshakeListeners) { handshakeDelegate(_handshake); } _handshakeComplete = true; _handshakeListeners.Clear(); // send initial value snapshot notifyValueChange(); } if (!ExternalCalls.isInIFrame()) { Message.InitialSetupComplete initialSetupComplete = new Message.InitialSetupComplete(); initialSetupComplete.handshake = _handshake; initialSetupComplete.handshake.config = new SimCapiConfig(); initialSetupComplete.handshake.config.context = "VIEWER"; handleInitialSetupComplete(initialSetupComplete); } }