Esempio n. 1
0
        public void OnPreviewToolRegistrationReceivedFromWebApp(Regex regex)
        {
            lock (this)
            {
                previewPartIdRegex = regex;

                if (lastContentUpdateRequest != null)
                {
                    var contentUpdateParams = lastContentUpdateRequest.ConvertRequestToContentUpdateParams(previewPartIdRegex);
                    if (contentUpdateParams.PreviewParts.Length > 0)
                    {
                        var postMessage = new ContentUpdateMessage(contentUpdateParams).SerializeToPostMessage();
                        executeJavaScriptAsync(postMessage);
                        lastContentUpdateRequest = null;
                    }

                    if (lastChangeHighlightRequest != null)
                    {
                        var changeHighlightParams = lastChangeHighlightRequest.ConvertRequestToChangeHighlightParams(previewPartIdRegex);
                        if (changeHighlightParams.ActivePreviewParts.Length > 0)
                        {
                            var postMessage = new ChangeHighlightInPreviewMessage(changeHighlightParams).SerializeToPostMessage();
                            executeJavaScriptAsync(postMessage);
                            lastChangeHighlightRequest = null;
                        }
                    }
                }
                else
                {
                    requestPreviewPartIdUpdate();
                }
            }
        }
Esempio n. 2
0
        public void HandleContentUpdateRequest(ContentUpdateRequestFromMQ contentUpdateRequest)
        {
            lock (this)
            {
                if (externalToolAddress == null)
                {
                    foreach (var previewPart in contentUpdateRequest.PreviewParts)
                    {
                        if (updateExternalToolAddress(previewPart.PreviewProperties))
                        {
                            break;
                        }
                    }
                }

                if (previewPartIdRegex != null)
                {
                    var contentUpdateParams = contentUpdateRequest.ConvertRequestToContentUpdateParams(previewPartIdRegex);
                    if (contentUpdateParams.PreviewParts.Length > 0)
                    {
                        var postMessage = new ContentUpdateMessage(contentUpdateParams).SerializeToPostMessage();
                        executeJavaScriptAsync(postMessage);
                    }

                    if (lastChangeHighlightRequest != null)
                    {
                        var changeHighlightParams = lastChangeHighlightRequest.ConvertRequestToChangeHighlightParams(previewPartIdRegex);
                        if (changeHighlightParams.ActivePreviewParts.Length > 0)
                        {
                            var postMessage = new ChangeHighlightInPreviewMessage(changeHighlightParams).SerializeToPostMessage();
                            executeJavaScriptAsync(postMessage);
                            lastChangeHighlightRequest = null;
                        }
                    }
                }
                else
                {
                    lastContentUpdateRequest = contentUpdateRequest;
                }
            }
        }
Esempio n. 3
0
        public void HandleChangeHighlightRequest(ChangeHighlightRequestFromMQ changeHighlighRequest)
        {
            lock (this)
            {
                updateExternalToolAddress(changeHighlighRequest.ActivePreviewParts[0].PreviewProperties);

                if (previewPartIdRegex != null)
                {
                    var changeHighlightParams = changeHighlighRequest.ConvertRequestToChangeHighlightParams(previewPartIdRegex);
                    if (changeHighlightParams.ActivePreviewParts.Length > 0)
                    {
                        var postMessage = new ChangeHighlightInPreviewMessage(changeHighlightParams).SerializeToPostMessage();
                        executeJavaScriptAsync(postMessage);
                    }
                }
                else
                {
                    lastChangeHighlightRequest = changeHighlighRequest;
                }
            }
        }