void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 8 "..\..\Window1.xaml" ((TextRedactor.Window1)(target)).Closed += new System.EventHandler(this.Window_Closed); #line default #line hidden #line 8 "..\..\Window1.xaml" ((TextRedactor.Window1)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.TextRedactor = ((UILayer.SuperTextRedactor)(target)); return; } this._contentLoaded = true; }
public void Init(SuperTextRedactor parent) { parentControl = parent; // document = parentControl.TextBox.MainControl; TextBoxAuthor.Text = project.Author; TextBoxTitle.Text = project.Name; LoadPreview(parentControl.BrowseProject.CurentFile); //ExportTextBox.Document = new FlowDocument(); //foreach (var doc in project.Files) //{ // FlowDocument paragraph = new FlowDocument(); // //using (var fStream = new FileStream(doc.Path, FileMode.OpenOrCreate, FileAccess.Read)) // //{ // try // { // FileWorkerManager.Do(paragraph, doc.Path, false); // // new TextRange(paragraph.ContentStart, paragraph.ContentEnd).Load(fStream, System.Windows.DataFormats.Rtf); // } // catch (Exception ex) // { // System.Windows.MessageBox.Show(ex.Message); // return; // } // // } // ExportTextBox.Document.Blocks.AddRange(paragraph.Blocks.ToList()); //} }
public void UpdateOffsetOnNotes() { byte[] flag = NotesBrowser.getJPGFromImageControl(Properties.Resources.noteFlag); for (int i = ParentControl.NotesBrowser.Notes.Count - 1; i >= 0; i--) { var note = ParentControl.NotesBrowser.Notes.ElementAt(i); var a = SuperTextRedactor.TestRange(note.Value.Range); note.Value.Range.ApplyPropertyValue(TextElement.BackgroundProperty, null); for (TextPointer position = note.Value.Range.Start; position != null && position.CompareTo(note.Value.Range.End) != 1; position = position.GetNextContextPosition(LogicalDirection.Forward)) { InlineUIContainer element = position.Parent as InlineUIContainer; if (element != null && element.Child is System.Windows.Controls.Image) { var image = element.Child as System.Windows.Controls.Image; if (image == null) { continue; } var imageSourse = image.Source as System.Windows.Media.ImageSource; if (imageSourse == null) { continue; } byte[] byt = NotesBrowser.getJPGFromImageControl(imageSourse); //сравнивает картинки if (byt.Length == flag.Length) { bool isflag = true; for (int t = 0; t < byt.Length; t++) { if (byt[t] != flag[t]) { isflag = false; break; } } if (!isflag) { continue; } element.Unloaded -= Element_Unloaded; element.SiblingInlines.Remove(element); break; } } } note.Value.OffsetStart = ParentControl.TextBox.MainControl.Document.ContentStart.GetOffsetToPosition(note.Value.Range.Start); note.Value.OffsetEnd = ParentControl.TextBox.MainControl.Document.ContentStart.GetOffsetToPosition(note.Value.Range.End); } if (ParentControl.searchPanel != null) { ParentControl.searchPanel.ClearSearch(); } }
public static void RestoreOriginalState(SuperTextRedactor control) { new TextRange (control.TextBox.MainControl.Document.ContentStart, control.TextBox.MainControl.Document.ContentEnd) .ApplyPropertyValue(TextElement.BackgroundProperty, null); foreach (var item in control.NotesBrowser.Notes) { item.Value.Range.ApplyPropertyValue(TextElement.BackgroundProperty, Brushes.PaleGreen); } }
public DictionaryPanel(SuperTextRedactor Parent) { InitializeComponent(); ParentControl = Parent; }
public SearchPanel(SuperTextRedactor Parent) { InitializeComponent(); ParentControl = Parent; }