private void UpdatePreview(ApiRequest request) { InitializeLanguagesInBook(request); _lastSettings = GetSettings(); _lastThumbnailBackgroundColor = _thumbnailBackgroundColor; PreviewUrl = StageBloomD(request.CurrentBook, _bookServer, _progress, _thumbnailBackgroundColor, _lastSettings); _webSocketServer.SendString(kWebSocketContext, kWebsocketEventId_Preview, PreviewUrl); }
private void SetPeakLevel(PeakLevelEventArgs args) { var level = Math.Round(args.Level, 3); if (level != _previousLevel) { _previousLevel = level; _webSocketServer.SendString(kWebsocketContext, "peakAudioLevel", level.ToString(CultureInfo.InvariantCulture)); } }
// This is only called if there is a Lifespan generated (and it gets disposed) and that will only happen // if Measure() decided that we are in measuring mode. private void MeasurementEnded(Measurement measure) { _stream.WriteLine(measure.GetCsv()); _webSocketServer.SendString(kWebsocketContext, "event", JsonConvert.SerializeObject(measure.GetSummary())); _measurement = null; _measurements.Add(measure); }
private void RefreshOneThumbnail(Book.BookInfo bookInfo, Image image) { // The arguments here are not currently used (method signature is legacy), // but may be useful if we optimize. // optimize: I think this will reload all of them _webSocketServer.SendString("bookImage", "reload", bookInfo.Id); }
private void ShowBook(bool updatePreview = true) { if (_bookSelection.CurrentSelection == null || !_visible) { HidePreview(); } else { Debug.WriteLine("LibraryBookView.ShowBook() currentselection ok"); _readmeBrowser.Visible = false; _splitContainerForPreviewAndAboutBrowsers.Visible = true; if (updatePreview && !TroubleShooterDialog.SuppressBookPreview) { var previewDom = _bookSelection.CurrentSelection.GetPreviewHtmlFileForWholeBook(); XmlHtmlConverter.MakeXmlishTagsSafeForInterpretationAsHtml(previewDom.RawDom); var fakeTempFile = BloomServer.MakeSimulatedPageFileInBookFolder(previewDom, setAsCurrentPageForDebugging: false, source: BloomServer.SimulatedPageFileSource.Preview); _reactBookPreviewControl.Props = new { initialBookPreviewUrl = fakeTempFile.Key }; // need this for initial selection _webSocketServer.SendString("bookStatus", "changeBook", fakeTempFile.Key); // need this for changing selection display _webSocketServer.SendEvent("bookStatus", "reload"); // need this for changing selection's book info display if team collection _reactBookPreviewControl.Visible = true; RecordAndCleanupFakeFiles(fakeTempFile); } _splitContainerForPreviewAndAboutBrowsers.Panel2Collapsed = true; if (_bookSelection.CurrentSelection.HasAboutBookInformationToShow) { if (RobustFile.Exists(_bookSelection.CurrentSelection.AboutBookHtmlPath)) { _splitContainerForPreviewAndAboutBrowsers.Panel2Collapsed = false; _readmeBrowser.Navigate(_bookSelection.CurrentSelection.AboutBookHtmlPath, false); _readmeBrowser.Visible = true; } else if (RobustFile.Exists(_bookSelection.CurrentSelection.AboutBookMdPath)) { _splitContainerForPreviewAndAboutBrowsers.Panel2Collapsed = false; var md = new Markdown(); var contents = RobustFile.ReadAllText(_bookSelection.CurrentSelection.AboutBookMdPath); _readmeBrowser.NavigateRawHtml(string.Format("<html><head><meta charset=\"utf-8\"/></head><body>{0}</body></html>", md.Transform(contents))); _readmeBrowser.Visible = true; } } _reshowPending = false; } }
private void SendCleanupState() { var endState = "{\"CanAddPages\":false,\"CanDeletePage\":false,\"CanDuplicatePage\":false,\"BookLockedState\":\"OriginalBookMode\"}"; _webSocketServer.SendString(kWebsocketContext, kWebsocketStateId, endState); }
// Message is presumed already localized. private void ReportProgress(string message) { _webSocketServer.SendString(kWebsocketContext, kWebsocketEventId_Progress, message); }
private void UpdatePreview(ApiRequest request) { _publishToAndroidApi.MakeBloompubPreview(request, true); // MakeBloompubPreview ensures that LicenseOK is set appropriately. _webSocketServer.SendString("recordVideo", "publish/licenseOK", _publishToAndroidApi.LicenseOK ? "true" : "false"); }
public static void UpdateButtonTitle(BloomWebSocketServer server, BookInfo bookInfo, string bestTitle) { server.SendString("book", IdForBookButton(bookInfo), bestTitle); }