public static DocumentAdv LoadDocumentAdv(List <TextPage> pages) { var documentAdv = new DocumentAdv(); SectionAdv sectionAdv = new SectionAdv(); documentAdv.Sections.Add(sectionAdv); foreach (var textPage in pages) { foreach (var paragraph in textPage.Paragraphs) { var paragraphAdv = new ParagraphAdv(); sectionAdv.Blocks.Add(paragraphAdv); foreach (var line in paragraph.Lines) { foreach (var word in line.Words) { SpanAdv spanAdv = new SpanAdv { Text = word.Word + " " }; if (word.Bold) { spanAdv.FontWeight = FontWeights.Bold; } paragraphAdv.Inlines.Add(spanAdv); } } } } return(documentAdv); }
public DictionaryViewModel() { _dictionaryPassword = new ObservableCollection <DictionaryPasswordElement>(); _documentAdv = new DocumentAdv(); _searcText = "Szukane słowo"; }
public string Convert(DocumentAdv document) { var htmlDocument = string.Empty; foreach (var section in document.Sections) { htmlDocument += ConvertSection(section as SectionAdv); } return(htmlDocument); }
//zerowanie wartości private void ExecuteNewCommand() { _textToRecognize = new DocumentAdv(); RaisePropertyChanged(TextToRecognizePropertyName); _recognizePasswordListObservableCollection = new ObservableCollection <DictionaryPasswordElement>(); RaisePropertyChanged(RecognizePasswordListPropertyName); _enableAfterAnalize = false; _enableAfterOpen = false; RaisePropertyChanged(EnableAfterAnalizePropertyName); RaisePropertyChanged(EnableAfterOpenPropertyName); }
public static DocumentAdv ParsowanieHtml(ObservableCollection <DictionaryPasswordElement> dictionaryPasswordElements) { var documentAdv = new DocumentAdv(); var sectionAdv = new SectionAdv(); documentAdv.Sections.Add(sectionAdv); var paragraphPassword = new ParagraphAdv(); sectionAdv.Blocks.Add(paragraphPassword); var paragraphDescryption = new ParagraphAdv(); sectionAdv.Blocks.Add(paragraphDescryption); foreach (var element in dictionaryPasswordElements) { if (element.Description.Contains("has³o")) { var spanAdv = new SpanAdv { Text = element.Word + " ", Foreground = Color.FromRgb(0, 128, 0), FontSize = 24, }; paragraphPassword.Inlines.Add(spanAdv); } else if (element.Word.Contains("I,") || element.Word.Contains("II,") || element.Word.Contains("III,") || element.Word.Contains("IV,") || element.Word.Contains("I ") || element.Word.Contains("II ") || element.Word.Contains("III ") || element.Word.Contains("IV ")) { var hyperlinkAdv = new HyperlinkAdv { Text = element.Word + " ", NavigationUrl = @"tabele/meski_" + element.Word.Trim(',') + ".jpg", Foreground = Colors.DarkBlue }; paragraphPassword.Inlines.Add(hyperlinkAdv); } else if (element.Description.Contains("definicja")) { //var hyperlinkAdv = new HyperlinkAdv //{ // Text = element.Word + " \n", // NavigationUrl = "javascript:alert('" + element.Description + "')", // Foreground = Colors.Black //}; //paragraphDescryption.Inlines.Add(shyperlinkAdv); var spanAdv = new SpanAdv { Text = element.Word + " \n" }; paragraphDescryption.Inlines.Add(spanAdv); } else if (element.Description.Contains("cytat")) { var paragraphCitation = new ParagraphAdv { ListType = ListType.Bulleted }; sectionAdv.Blocks.Add(paragraphCitation); //var hyperlinkAdv = new HyperlinkAdv //{ // Text = element.Word + " \n", // NavigationUrl = "javascript:alert('" + element.Description + "')", // Foreground = Colors.Black //}; //paragraphCitation.Inlines.Add(hyperlinkAdv); var spanAdv = new SpanAdv { Text = element.Word + " \n" }; paragraphCitation.Inlines.Add(spanAdv); } else if (element.Description.Contains("wyjaœnienie etymologiczne wyrazu")) { var paragraphLatin = new ParagraphAdv(); sectionAdv.Blocks.Add(paragraphLatin); //var hyperlinkAdv = new HyperlinkAdv //{ // Text = element.Word + " ", // NavigationUrl = "javascript:alert('" + element.Description + "')", // Foreground = Colors.Black //}; //paragraphLatin.Inlines.Add(hyperlinkAdv); var spanAdv = new SpanAdv { Text = element.Word + " " }; paragraphLatin.Inlines.Add(spanAdv); } else { var spanAdv = new SpanAdv { Text = element.Word + " ", }; paragraphPassword.Inlines.Add(spanAdv); } } return(documentAdv); }
public RecognizeViewModel(IDataExchangeViewModel dataExchangeViewModel) { _dataExchangeViewModel = dataExchangeViewModel; if (IsInDesignMode) { var _text = "animalistyka ż III blm szt. «przedstawianie zwierząt lub motywów zwierzęcych w sztukach plastycznych, " + "w fotografice»: Do mistrzostwa doprowadził sztukę fotograficzną, szczególniej w tak trudnym dziale jak animalistyka " + "(zdjęcia zwierząt). Probl. 1954, s. 570. <łc. animal = zwierzę>"; _textToRecognize = _textImporting.ConvertToDocumentAdv(_text); _dictionary = new Dictionary <string, string> { { "aaa", "bbb" }, { "ccc", "ddd" } }; _digDictionaries = new ObservableCollection <DictionaryPasswordElement> { new DictionaryPasswordElement { Word = "Zabawa", Description = "zabawa" }, new DictionaryPasswordElement { Word = "AAA1", Description = "aaa1" }, new DictionaryPasswordElement { Word = "BBB1", Description = "bbb1" } }; _recognizePasswordListObservableCollection = new ObservableCollection <DictionaryPasswordElement> { new DictionaryPasswordElement { Word = "AAd1", Description = "aa1" }, new DictionaryPasswordElement { Word = "AA2", Description = "aa2" }, new DictionaryPasswordElement { Word = "AA3", Description = "aa3" } }; } else { if (_dataExchangeViewModel.ContainsKey(EnumExchangeViewmodel.TextToRecognize)) { _textToRecognize = (DocumentAdv)_dataExchangeViewModel.Item(EnumExchangeViewmodel.TextToRecognize); _enableAfterOpen = true; RaisePropertyChanged(EnableAfterOpenPropertyName); RaisePropertyChanged(TextToRecognizePropertyName); } else { _textToRecognize = new DocumentAdv(); } _recognizePasswordListObservableCollection = new ObservableCollection <DictionaryPasswordElement>(); LoadDictionaryPassword(); } _recognizePasswordText = new FactoryRecognizePassword(); }