private void Search() { PdfSearchVM vm = DataContext as PdfSearchVM; vm.Clear(); searchResults.Clear(); if (foxit != null) { foxit.SetSearchHighlightFillColor((uint)ColorTranslator.ToOle(System.Drawing.Color.Tomato), 200); if (!String.IsNullOrEmpty(Query.Text)) { FindResult result = foxit.FindFileFirst(foxit.FilePath, Query.Text, MatchCase.IsChecked.Value, WholeWord.IsChecked.Value); if (result != null) { vm.Results.Add(new PdfSearchResultVM { PageNum = result.GetFindPageNum() + 1, ResultText = result.GetFindString(), FindResult = result }); FindResult nextResult; while ((nextResult = foxit.FindFileNext()) != null) { vm.Results.Add(new PdfSearchResultVM { PageNum = nextResult.GetFindPageNum() + 1, ResultText = nextResult.GetFindString(), FindResult = nextResult }); } vm.TotalCount = $"{vm.Results.Count} Found."; } } } else { AppInfoBox.ShowInfoMessage("Pdf Document Not Available"); } }
public bool?OpenDocument(string PdfPath, bool showControls = true) { try { DialogStatus = false; if (File.Exists(PdfPath)) { string DocumentPath = Path.Combine(T.TanFolderpath, "LocalPdfs", Path.GetFileName(PdfPath)); if (!Directory.Exists(Path.GetDirectoryName(DocumentPath))) { Directory.CreateDirectory(Path.GetDirectoryName(DocumentPath)); } if (!File.Exists(DocumentPath)) { File.Copy(PdfPath, DocumentPath); } AxFoxitPDFSDK foxit = PdfHost.Child as AxFoxitPDFSDK; AxFoxitPDFSDK foxitSplitted = PdfHostSplitted.Child as AxFoxitPDFSDK; OpenPdf(foxit, DocumentPath); OpenPdf(foxitSplitted, DocumentPath); if (showControls) { CompleteBtn.Visibility = Visibility.Visible; } else { CompleteBtn.Visibility = Visibility.Hidden; Show(); } if (showControls) { if (File.Exists(T.MasterTanDataFilePath)) { var TanInfoDto = JsonConvert.DeserializeObject <TanInfoDTO>(File.ReadAllText(T.MasterTanDataFilePath)); TanInfoDto.Tan.DocumentReadStartTime = DateTime.Now; string masterTanJson = JsonConvert.SerializeObject(TanInfoDto); System.IO.File.WriteAllText(T.MasterTanDataFilePath, masterTanJson); } return(ShowDialog()); } } else { AppInfoBox.ShowInfoMessage("PDF File not Found. Please Try after some time."); } return(false); } catch (Exception ex) { Log.This(ex); } return(null); }
private void chemEditor_ComStructureChanged() { try { string MolFormula = GetMoleculeFormula(chemEditor.MolfileString); if (EditChemicalString && !String.IsNullOrEmpty(chemEditor.MolfileString)) { var inchiKey = MolToInchi.Mol2Inchi(chemEditor.MolfileString); if (!string.IsNullOrEmpty(inchiKey)) { var chemical = T.FindByInchiKey(inchiKey); if (chemical == null) { chemical = popupViewModel.TanChemicalVMList.Where(cn => cn.InChiKey != null && cn.Id != popupViewModel.SelectedTanChemicalVM.Id && cn.InChiKey == inchiKey).FirstOrDefault(); } if (chemical != null) { AppInfoBox.ShowInfoMessage(chemical.GetDuplicateChemicalString(inchiKey)); chemEditor.MolfileString = string.Empty; return; } } } if (!String.IsNullOrEmpty(chemEditor.MolfileString) && !EditChemicalString) { var inchiKey = MolToInchi.Mol2Inchi(chemEditor.MolfileString); if (!String.IsNullOrEmpty(inchiKey)) { var chemical = T.FindByInchiKey(inchiKey); if (chemical == null) { chemical = popupViewModel.TanChemicalVMList.Where(cn => cn.InChiKey != null && cn.InChiKey == inchiKey).FirstOrDefault(); } if (chemical != null) { AppInfoBox.ShowInfoMessage(chemical.GetDuplicateChemicalString(inchiKey)); chemEditor.MolfileString = string.Empty; return; } } popupViewModel.MolString = chemEditor.MolfileString; popupViewModel.MolFormula = MolFormula; } } catch (Exception ex) { Log.This(ex); } }
private void ReactionsList_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { string DocumentPath; if (ReactionsList.SelectedValue != null) { DocumentPath = Path.Combine(C.UserManualsPath, (ReactionsList.SelectedValue as UserManualVM).Value); if (File.Exists(DocumentPath)) { AxFoxitPDFSDK foxit = UserPdfHost.Child as AxFoxitPDFSDK; if (foxit != null) { foxit.UnLockActiveX(C.LICENCE_ID, C.UNLOCK_CODE); foxit.ShowTitleBar(false); foxit.ShowToolBar(false); foxit.ShowNavigationPanels(true); foxit.SetShowSavePrompt(false, 0); } if (foxit != null) { if (!foxit.OpenFile(DocumentPath, String.Empty)) { AppErrorBox.ShowErrorMessage("Can't open pdf file", "Can't open pdf file"); } } } else { AppInfoBox.ShowInfoMessage("PDF File not Found. Please Try after some time."); } } } catch (Exception ex) { Log.This(ex); } }