コード例 #1
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;
                }
            }
        }
コード例 #2
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;
                }
            }
        }