void ButtonNewManual_Click(object sender, RoutedEventArgs e) { ButtonHelpPopup.Close(); PDFDocument pdf_document = QiqqaManualTools.AddManualsToLibrary(WebLibraryManager.Instance.WebLibraryDetails_Guest.library); MainWindowServiceDispatcher.Instance.OpenDocument(pdf_document); }
public void SerializeBasicLibrary() { // TODO: overrule DB directory etc by overriding LIBRARY_BASE_PATH et al... // set up a clean library with the default two manual files: WebLibraryDetail new_web_library_detail = new WebLibraryDetail(); new_web_library_detail.Id = "UnitTest"; new_web_library_detail.Title = "Local UnitTest Library"; new_web_library_detail.Description = "This is the library that comes with your Qiqqa unit test(s)."; new_web_library_detail.Deleted = false; new_web_library_detail.Xlibrary = new Library(new_web_library_detail); PDFDocument doc2 = QiqqaManualTools.AddManualsToLibrary(new_web_library_detail); ASSERT.IsNotNull(doc2); ASSERT.AreEqual <int>(new_web_library_detail.Xlibrary.PDFDocuments.Count, 2); string json = JsonConvert.SerializeObject(doc2, Formatting.Indented); // Perform comparison via ApprovalTests->BeyondCompare (that's what I use for *decades* now) string json_out = JsonConvert.SerializeObject(doc2, Formatting.Indented).Replace("\r\n", "\n"); string path = GetNormalizedPathToSerializationTestFile("PDFDocument/SerializeBasicLibrary/Manual-Doc-02-serialized.json"); //ApprovalTests.Approvals.VerifyJson(json_out); --> becomes the code below: ApprovalTests.Approvals.Verify( new QiqqaApprover(json_out, path), ApprovalTests.Approvals.GetReporter() ); //new_web_library_detail.library.Dispose(); ASSERT.IsTrue(true); }
// ************************************************************************************************************* private void AddLocalGuestLibraryIfMissing() { // Check if we have an existing Guest library foreach (var pair in web_library_details) { if (pair.Value.IsLocalGuestLibrary) { guest_web_library_detail = pair.Value; break; } } // If we did not have a guest library, create one... if (null == guest_web_library_detail) { WebLibraryDetail new_web_library_detail = new WebLibraryDetail(); new_web_library_detail.Id = "Guest"; new_web_library_detail.Title = "Local Guest Library"; new_web_library_detail.Description = "This is the library that comes with your Qiqqa guest account."; new_web_library_detail.Deleted = false; new_web_library_detail.IsLocalGuestLibrary = true; new_web_library_detail.library = new Library(new_web_library_detail); web_library_details[new_web_library_detail.Id] = new_web_library_detail; // Store this reference to guest guest_web_library_detail = new_web_library_detail; } // Import the Qiqqa manuals... QiqqaManualTools.AddManualsToLibrary(guest_web_library_detail.library); }
private void ButtonNewManual_Click(object sender, RoutedEventArgs e) { ButtonHelpPopup.Close(); if (Runtime.IsRunningInVisualStudioDesigner) { return; } PDFDocument pdf_document = QiqqaManualTools.AddManualsToLibrary(WebLibraryManager.Instance.Library_Guest); MainWindowServiceDispatcher.Instance.OpenDocument(pdf_document); }
// ************************************************************************************************************* private void AddLocalGuestLibraryIfMissing() { // Check if we have an existing Guest library foreach (var pair in web_library_details) { if (pair.Value.IsLocalGuestLibrary) { guest_web_library_detail = pair.Value; break; } } // If we did not have a guest library, create one... if (null == guest_web_library_detail) { WebLibraryDetail new_web_library_detail = new WebLibraryDetail(); new_web_library_detail.Id = "Guest"; new_web_library_detail.Title = "Local Guest Library"; new_web_library_detail.Description = "This is the library that comes with your Qiqqa guest account."; new_web_library_detail.Deleted = false; new_web_library_detail.IsReadOnly = false; new_web_library_detail.IsLocalGuestLibrary = true; UpdateKnownWebLibrary(new_web_library_detail); // Store this reference to guest guest_web_library_detail = new_web_library_detail; } // Import the Qiqqa manuals in the background, waiting until the library has loaded... SafeThreadPool.QueueUserWorkItem(o => { while (!guest_web_library_detail.library.LibraryIsLoaded) { if (Utilities.Shutdownable.ShutdownableManager.Instance.IsShuttingDown) { return; } System.Threading.Thread.Sleep(500); } QiqqaManualTools.AddManualsToLibrary(guest_web_library_detail.library); }); }
// ************************************************************************************************************* private void ImportManualsIntoLocalGuestLibraryIfMissing() { WPFDoEvents.AssertThisCodeIs_NOT_RunningInTheUIThread(); // Import the Qiqqa manuals in the background, waiting until the library has loaded... SafeThreadPool.QueueUserWorkItem(o => { while (!guest_web_library_detail.library.LibraryIsLoaded) { if (Utilities.Shutdownable.ShutdownableManager.Instance.IsShuttingDown) { return; } System.Threading.Thread.Sleep(500); } QiqqaManualTools.AddManualsToLibrary(guest_web_library_detail.library); }); }
// ************************************************************************************************************* private void ImportManualsIntoLocalGuestLibraryIfMissing() { if (Runtime.IsRunningInVisualStudioDesigner) { return; } WPFDoEvents.AssertThisCodeIs_NOT_RunningInTheUIThread(); // Import the Qiqqa manuals in the background, waiting until the library has loaded... SafeThreadPool.QueueAsyncUserWorkItem(async() => { while (!guest_web_library_detail.Xlibrary.LibraryIsLoaded) { if (ShutdownableManager.Instance.IsShuttingDown) { return; } await Task.Delay(500); } QiqqaManualTools.AddManualsToLibrary(guest_web_library_detail); }); }